Matchmaking Service
概要
方法
GetServerAttribute(name: string):Tuple |
InitializeServerAttributesForStudio(serverAttributes: Dictionary):Tuple |
SetServerAttribute(name: string,value: Variant):Tuple |
APIリファレンス
方法
Initialize Server Attributes For Studio
パラメータ
戻り値
Set Server Attribute
パラメータ
value:Variant |
戻り値
コードサンプル
マッチメイキングサービスのサンプル
local MatchmakingService = game:GetService("MatchmakingService")
local RunService = game:GetService("RunService")
if RunService:IsStudio() then
-- テストのために初期属性とスキーマを設定します
MatchmakingService:InitializeServerAttributesForStudio({
Level = "Advanced",
Elo = 123.456,
TrainingMode = true
})
end
-- Level属性を取得します
local currentLevel, errorMessage = MatchmakingService:GetServerAttribute("Level")
if errorMessage then
warn(errorMessage)
else
print("現在のレベル: " .. currentLevel)
end
-- Level属性の値をAdvancedに更新します
local success, setErrorMessage = MatchmakingService:SetServerAttribute("Level", "Advanced")
if not success then
warn("サーバー属性[Level]を[Advanced]に更新できませんでした。エラー: " .. setErrorMessage)
else
print("[Level]を[Advanced]に正常に設定しました")
end