Clase de motor
MatchmakingService
*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
GetServerAttribute
InitializeServerAttributesForStudio
Parámetros
Devuelve
SetServerAttribute
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, errorMessage = MatchmakingService:SetServerAttribute("Level", "Avanzado")
if not success then
warn("Fallo al actualizar el atributo del servidor [Level] a [Avanzado] debido a error: " .. errorMessage)
else
print("Se estableció correctamente [Level] a [Avanzado]")
end