學習
引擎類別
MatchmakingService
無法建立
服務
未複製

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡


概要
繼承成員

API 參考
方法
GetServerAttribute
功能: Basic
MatchmakingService:GetServerAttribute(name:string):Tuple
參數
name:string
返回

InitializeServerAttributesForStudio
功能: Basic
MatchmakingService:InitializeServerAttributesForStudio(serverAttributes:Dictionary):Tuple
參數
serverAttributes:Dictionary
返回

SetServerAttribute
功能: Basic
MatchmakingService:SetServerAttribute(
name:string, value:Variant
參數
name:string
value:Variant
返回
範例程式碼
配對服務範例
local MatchmakingService = game:GetService("MatchmakingService")
local RunService = game:GetService("RunService")
if RunService:IsStudio() then
-- 設置測試的初始屬性和架構
MatchmakingService:InitializeServerAttributesForStudio({
Level = "進階",
Elo = 123.456,
TrainingMode = true
})
end
-- 獲取 Level 屬性
local currentLevel, errorMessage = MatchmakingService:GetServerAttribute("Level")
if errorMessage then
warn(errorMessage)
else
print("當前等級: " .. currentLevel)
end
-- 將 Level 屬性值更新為進階
local success, errorMessage = MatchmakingService:SetServerAttribute("Level", "進階")
if not success then
warn("更新伺服器屬性 [Level] 為 [進階] 失敗,錯誤: " .. errorMessage)
else
print("成功將 [Level] 設定為 [進階]")
end

©2026 Roblox Corporation、Roblox、Roblox 標誌及 Powering Imagination 是我們在美國及其他國家地區的部分註冊與未註冊商標。