Classe do mecanismo
MatchmakingService
*Este conteúdo é traduzido por IA (Beta) e pode conter erros. Para ver a página em inglês, clique aqui.
Resumo
Métodos
GetServerAttribute(name: string):Tuple |
InitializeServerAttributesForStudio(serverAttributes: Dictionary):Tuple |
SetServerAttribute(name: string,value: Variant):Tuple |
Referência API
Métodos
GetServerAttribute
InitializeServerAttributesForStudio
Parâmetros
Devolução
SetServerAttribute
Parâmetros
value:Variant |
Devolução
Amostras de código
Exemplo do MatchmakingService
local MatchmakingService = game:GetService("MatchmakingService")
local RunService = game:GetService("RunService")
if RunService:IsStudio() then
-- Configura os atributos iniciais e o esquema para teste
MatchmakingService:InitializeServerAttributesForStudio({
Level = "Avançado",
Elo = 123.456,
TrainingMode = true
})
end
-- Recupera o atributo Level
local currentLevel, errorMessage = MatchmakingService:GetServerAttribute("Level")
if errorMessage then
warn(errorMessage)
else
print("Nível atual: " .. currentLevel)
end
-- Atualiza o valor do atributo Level para Avançado
local success, errorMessage = MatchmakingService:SetServerAttribute("Level", "Avançado")
if not success then
warn("Falha ao atualizar o atributo do servidor [Level] para [Avançado] devido a erro: " .. errorMessage)
else
print("Atributo [Level] definido com sucesso para [Avançado]")
end