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

Is there anything wrong with this script?

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

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
10 years ago
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)
0
How do you fix the thing with the teams,like the brickcolor.New,I want to know how to change them? DerpTrollark 20 — 10y
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. M39a9am3R 3210 — 10y
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 DerpTrollark 20 — 10y
Ad

Answer this question