Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make players change team on death?

team1 = game.Teams("Humans")
team2 = game.Teams("Aliens")


function OnDeath()
Player.TeamColor = team2
end
end

humanoid.Died:connect(OnDeath)  


Im not sure if my script is correct,but if it isn't please help me. Im trying to make a script so that when a player dies he/her will go to team2

1 answer

✓ Accepted answer
team1 = game.Teams["Humans"]
team2 = game.Teams["Aliens"]

Game.Players.PlayerAdded:connect(function(Player) --When a Player joins
    Player.CharacterAdded:connect(function(Character) --When they respawn
        Character.Humanoid.Died:connect(function() --When they die
             Player.TeamColor = team2.TeamColor --Put them on the 'Aliens' team
        end)
    end)
end)
--Place in a Script in ServerScriptService

This discussion is preserved as it was. New answers, comments, and votes are closed.