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

Why doesn't this change my team when I die?

Asked by 6 years ago
local team = game.Teams.Lobby
game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(chr)
        chr:WaitForChild("Humanoid").Died:connect(function()
            print(plr.Name.." died!")
plr.TeamColor = team
        end)
    end)
end)

Trying to make a script in workspace where when you die you change from Team Players to Team Lobby.

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

Again, It's best to use Teaminstead of TeamColor. It isn't working because your setting the player's TeamColor to a Team object, not a Team color.

game.Players.ChildAdded:connect(function(newPlayer) 
    newPlayer.CharacterAdded:connect(function(newCharacter)
        newCharacter.Humanoid.Died:connect(function()  --When player dies
            newPlayer.Team = game.Teams.Lobby --Set team to Lobby
        end)
    end)
end)

If this helped please accept my answer! Thanks!

0
Forgot to add, just put this script in the workspace and it works perfectly. PyccknnXakep 1225 — 6y
Ad

Answer this question