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

Is there anything wrong with this script?

team1 = game.Teams("Really red")
team2 = game.Teams("Bright blue")


function OnDeath()
Player.TeamColor = team2
end
end

humanoid.Died:connect(OnDeath) 	

What it is supposed to do is when a player dies they go to red team,And stay there. This is really new to me so I want to see if this is correct.

1 answer

✓ Accepted answer
team1 = BrickColor.new("Really red") --I have no idea what game.Teams with a BrickColor is, but I fixed it to BrickColor so that the team will change properly.
team2 = BrickColor.new("Bright blue") --I have no idea what game.Teams with a BrickColor is, but I fixed it to BrickColor so that the team will change properly.

game.Players.PlayerAdded:connect(function(p) -- You want to connect to the player, if they are in the game.
p.CharacterAdded:connect(function(c) --A Character now exists. Now you can use the died event.
c:WaitForChild("Humanoid").Died:connect(function() --We need to wait for Humanoid to exist and to die.
p.TeamColor = team2 --Now the player changes to Team2.
end)
end)
end)

3 comments

0

How do you fix the thing with the teams,like the brickcolor.New,I want to know how to change them?

0

Well, you're going to want to find the color you want, and it should have a name on it, so put that name in the quotes, and then it should change the player to that team color.

0

I really don't know what you mean,Do you mind editing it for me? And what I mean,Instead of finding brick color you find team name

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