Matchmaking Service
*Konten ini diterjemahkan menggunakan AI (Beta) dan mungkin mengandung kesalahan. Untuk melihat halaman ini dalam bahasa Inggris, klik di sini.
Ringkasan
Metode
GetServerAttribute(name: string):Tuple |
InitializeServerAttributesForStudio(serverAttributes: Dictionary):Tuple |
SetServerAttribute(name: string,value: Variant):Tuple |
Referensi API
Metode
Get Server Attribute
Initialize Server Attributes For Studio
Parameter
Memberikan nilai
Set Server Attribute
Parameter
value:Variant |
Memberikan nilai
Contoh Kode
Contoh Layanan Penjodohan
local MatchmakingService = game:GetService("MatchmakingService")
local RunService = game:GetService("RunService")
if RunService:IsStudio() then
-- Mengatur atribut awal dan skema untuk pengujian
MatchmakingService:InitializeServerAttributesForStudio({
Level = "Advanced",
Elo = 123.456,
TrainingMode = true
})
end
-- Mengambil atribut Level
local currentLevel, errorMessage = MatchmakingService:GetServerAttribute("Level")
if errorMessage then
warn(errorMessage)
else
print("Tingkat saat ini: " .. currentLevel)
end
-- Memperbarui nilai atribut Level menjadi Advanced
local success, setErrorMessage = MatchmakingService:SetServerAttribute("Level", "Advanced")
if not success then
warn("Gagal memperbarui atribut server [Level] menjadi [Advanced] karena kesalahan: " .. setErrorMessage)
else
print("Berhasil mengatur [Level] ke [Advanced]")
end