エンジンクラス
MatchmakingService
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
概要
方法
GetServerAttribute(name: string):Tuple |
InitializeServerAttributesForStudio(serverAttributes: Dictionary):Tuple |
SetServerAttribute(name: string,value: Variant):Tuple |
APIリファレンス
方法
InitializeServerAttributesForStudio
パラメータ
戻り値
SetServerAttribute
パラメータ
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, errorMessage = MatchmakingService:SetServerAttribute("Level", "Advanced")
if not success then
warn("[Level] を [Advanced] に更新する際にエラーが発生しました: " .. errorMessage)
else
print("[Level] を [Advanced] に正常に設定しました")
end