diff --git a/content/en-us/matchmaking/attributes-and-signals.md b/content/en-us/matchmaking/attributes-and-signals.md index 4f4bd9a86..5c967e735 100644 --- a/content/en-us/matchmaking/attributes-and-signals.md +++ b/content/en-us/matchmaking/attributes-and-signals.md @@ -211,12 +211,12 @@ local DataStoreService = game:GetService("DataStoreService") local eloStore = DataStoreService:GetDataStore("PlayerElo") function onMatchEnded(players: {Player}, winners: {Player}, losers: {Player}) - for _, player in players do - local updatedElo = CalculateUpdatedElo(player, winners, losers) - local success, errorMessage = pcall(function() - eloStore:SetAsync(player.UserId, updatedElo) - end) - end + for _, player in players do + local updatedElo = CalculateUpdatedElo(player, winners, losers) + local success, errorMessage = pcall(function() + eloStore:SetAsync(player.UserId, updatedElo) + end) + end end ``` @@ -225,30 +225,28 @@ 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 - }) + -- Sets up initial attributes and schema for testing + MatchmakingService:InitializeServerAttributesForStudio({ + Level = "Advanced", + Elo = 123.456, + TrainingMode = true + }) end -- Retrieves the Level attribute -local currentLevel, error = MatchmakingService:GetServerAttribute("Level") - -if error then - print(error) +local currentLevel, errorMessage = MatchmakingService:GetServerAttribute("Level") +if errorMessage then + warn(errorMessage) else - print("Current level: " .. currentLevel) + print("Current level: " .. currentLevel) end -- Updates the Level attribute value to Advanced -local success, error = MatchmakingService:SetServerAttribute("Level", "Advanced") +local success, errorMessage = MatchmakingService:SetServerAttribute("Level", "Advanced") if not success then - print("Failed to update server attribute [Level] to [Advanced] due to error: " .. error) + warn("Failed to update server attribute [Level] to [Advanced] due to error: " .. errorMessage) else - print("Successfully set [Level] to [Advanced]") + print("Successfully set [Level] to [Advanced]") end ``` @@ -386,10 +384,10 @@ local score = math.min(diff / max_relevant_difference, 1) The score is 1 when the server's attribute value (for example, Game Mode) is equal to the player's attribute value (for example, Preferred Game Mode). Otherwise, the signal score is 0. ```lua title="Joining player formula for server categorical signal" -if server_{attribute_name} = joining_player_{attribute_name} then - return 1 +if server_{attribute_name} == joining_player_{attribute_name} then + return 1 else - return 0 + return 0 end ``` @@ -397,10 +395,10 @@ end local server_GameMode = "Survival" local joining_player_GameMode = "Survival" -if server_GameMode = joining_player_GameMode then - return 1 +if server_GameMode == joining_player_GameMode then + return 1 else - return 0 + return 0 end ``` @@ -409,19 +407,19 @@ end The score is 1 when the server's attribute value is equal to a constant value of true. Otherwise, the signal score is 0. ```lua title="Constant value formula for server categorical signal" -if server_{attribute_name} = constant_value then - return 1 +if server_{attribute_name} == constant_value then + return 1 else - return 0 + return 0 end ``` ```lua title="Constant value example for server categorical signal" local server_GameNotStarted = true -if server_GameNotStarted = true then - return 1 +if server_GameNotStarted == true then + return 1 else - return 0 + return 0 end ```