Game.AwardWin
Declaration
Game.AwardWin(number PlayerID, number Wins, bool LockWin)
Description
Awards Wins amount of wins to the player with the specified PlayerID. LockWin decides if the Wins can be lost by dying in the standard gamemode.
Wins are only distributed once round ends, not instantly.
--Awards the first player with a win
local allPlayers = Players.GetAll();
Game.AwardWin(allPlayers[1], 1, false);
Declaration
Game.AwardWin(number PlayerID, TargetPlayer Mode, Vector3 Origin, number Wins, bool LockWin)
Description
Awards Wins amount of wins to the specified player(s), depending on the Mode. If using Mode set to Closest or Furthest, the Origin parameter will be used as the point of reference, otherwise Vector3.zero can be passed. LockWin decides if the Wins can be lost by dying in the standard gamemode.
Wins are only distributed once round ends, not instantly.
Check TargetPlayer for all possible Mode values.
--Awards everyone but the player with ID 2 with a win
local DontAward = 2;
local Mode = TargetPlayer.Others;
Game.AwardWin(DontAward, Mode, Vector3.zero, 1, false);
--Awards the third player with a win
local allPlayers = Players.GetAll();
Game.AwardWin(allPlayers[3], 1, false);
--Awards everyone on the same team as the passed player with a win
Game.AwardWin(1, TargetPlayer.AllTeamMembers, Vector3.zero, 1, false);
--Awards a random player with a win, the PlayerID parameter is not used
Game.AwardWin(0, TargetPlayer.Random, Vector3.zero, 1, false);
--Awards the closest player to the middle of the map with a win, PlayerID is once more not used
local world = World.GetSettings();
Game.AwardWin(0, TargetPlayer.Closest, V3(world.Width / 2, 1, world.Height / 2), 1, false);
Declaration
Game.AwardWin(Dictionary<number> PlayerIDs, number Wins, bool LockWin)
Description
Awards Wins amount of wins to the specified players. LockWin decides if the Wins can be lost by dying in the standard gamemode.
Wins are only distributed once round ends, not instantly.
--Retrieves every single player and awards them wins
local allPlayers = Players.GetAll();
Game.AwardWin(allPlayers, 1, false);
--Awards the second and fourth players with two wins and locks them
Game.AwardWin({allPlayers[2], allPlayers[4]}, 2, true);
Note
Player IDs must be whole numbers.
Keep in mind the Player IDs aren't necessarily ordered. Players can join and leave in the lobby, potentially several times, increasing their ID, which is why using Players.GetAll is advised if you want to target a player at a specific slot.
You can also pass Player objects instead of numbers as IDs.