Matchmaking Service
*Este contenido se traduce usando la IA (Beta) y puede contener errores. Para ver esta página en inglés, haz clic en aquí.
Resumen
Métodos
GetServerAttribute(name: string):Tuple |
InitializeServerAttributesForStudio(serverAttributes: Dictionary):Tuple |
SetServerAttribute(name: string,value: Variant):Tuple |
Referencia API
Métodos
Get Server Attribute
Initialize Server Attributes For Studio
Parámetros
Devuelve
Set Server Attribute
Parámetros
value:Variant |
Devuelve
Muestras de código
Ejemplo de MatchmakingService
local MatchmakingService = game:GetService("MatchmakingService")
local RunService = game:GetService("RunService")
if RunService:IsStudio() then
-- Configura los atributos iniciales y el esquema para pruebas
MatchmakingService:InitializeServerAttributesForStudio({
Level = "Avanzado",
Elo = 123.456,
TrainingMode = true
})
end
-- Recupera el atributo Level
local currentLevel, errorMessage = MatchmakingService:GetServerAttribute("Level")
if errorMessage then
warn(errorMessage)
else
print("Nivel actual: " .. currentLevel)
end
-- Actualiza el valor del atributo Level a Avanzado
local success, setErrorMessage = MatchmakingService:SetServerAttribute("Level", "Avanzado")
if not success then
warn("Error al actualizar el atributo del servidor [Level] a [Avanzado] debido al error: " .. setErrorMessage)
else
print("Se estableció correctamente [Level] a [Avanzado]")
end