Engine Class
MatchmakingService
Summary
Methods
GetServerAttribute(name: string):Tuple |
InitializeServerAttributesForStudio(serverAttributes: Dictionary):Tuple |
SetServerAttribute(name: string,value: Variant):Tuple |
API Reference
Methods
GetServerAttribute
InitializeServerAttributesForStudio
Parameters
Returns
SetServerAttribute
Parameters
value:Variant |
Returns
Code Samples
MatchmakingService sample
local MatchmakingService = game:GetService("MatchmakingService")
local RunService = game:GetService("RunService")
if RunService:IsStudio() then
-- Sets up initial attributes and schema for testing
MatchmakingService:InitializeServerAttributesForStudio({
Level = "Advanced",
Elo = 123.456,
TrainingMode = true
})
end
-- Retrieves the Level attribute
local currentLevel, errorMessage = MatchmakingService:GetServerAttribute("Level")
if errorMessage then
warn(errorMessage)
else
print("Current level: " .. currentLevel)
end
-- Updates the Level attribute value to Advanced
local success, errorMessage = MatchmakingService:SetServerAttribute("Level", "Advanced")
if not success then
warn("Failed to update server attribute [Level] to [Advanced] due to error: " .. errorMessage)
else
print("Successfully set [Level] to [Advanced]")
end