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

How do I make players change team on death?

Asked by 10 years ago
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

Log in to vote
2
Answered by 10 years ago
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
Ad

Answer this question