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

Help with changing teams on death?

Asked by
Scootakip 299 Moderation Voter
8 years ago
game.Players.LocalPlayer.CharacterAdded:connect(function(Character) 
        Character:WaitForChild('Humanoid').Died:connect(function()
            game.Players.LocalPlayer.TeamColor = BrickColor.new("White")
       end)
end)

This script basically changes the player's TeamColor to White when they die, and even though it works most of the time, on occasion, it breaks. Any help with why this might be happening?

2 answers

Log in to vote
0
Answered by 8 years ago

Hmm, maybe try the teamnames teamcolor?

example:

game.Players.LocalPlayer.TeamColor = game.Teams.TeamName.TeamColor

Ad
Log in to vote
0
Answered by
k3du53 162
8 years ago
Edited 8 years ago

I'm not sure what you mean by it breaking, but if you handled it on the server, maybe that would resolve your issue. (And would prevent complications if you decided to turn FilteringEnabled on)

Edited example from wiki

game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
            player.TeamColor = BrickColor.new("White")
        end)
    end)
end)

Hope I helped! If this works, don't forget to accept my answer!

Answer this question