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

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

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

✓ Accepted answer

Again, It's best to use Team instead 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!

1 comment

0

Forgot to add, just put this script in the workspace and it works perfectly.

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