Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a player win if he is the only one in a team?

Asked by
ko_oky -3
6 years ago
Edited 6 years ago

Basicly I am making like a fighting game. And I have 2 teams, lobby, ingame. When the intermission finishes, game starts and all players go to the map and all of them get switched from the lobby team to ingame team. The players will start fighting and the last who stands, win and earns +1 win and +5 coins.

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago
local team = game:GetService("Teams").ingame
team.PlayerRemoved:Connect(function()
    if #team:GetPlayers() == 1 then
        local plrWon = team:GetPlayers()[1]
        plrWon.leaderstats.wins.Value = plrWon.leaderstats.wins.Value + 1
        plrWon.leaderstats.coins.Value = plrWon.leaderstats.coins.Value + 5
    end
end)
Ad

Answer this question