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

Would this team changing script work?

Asked by 10 years ago
children = game.Players:GetChildren()

team1 = ("Bright blue")
team2 = ("Bright red")

children = team1 ("Bright blue")

if Player.Humanoid.Health = 0 then
    children = team2 ("Bright red")
end

2 answers

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

From my understanding, you want everyone to start on the blue team? And by some natural disaster or NPC, they go on the red team? If so, you'd need the Died event. If you want this to repeat, just put it in a while true do loop with a wait time of each round.

game.Players.PlayerAdded:connect(function(p)
    --p.TeamColor = BrickColor.new("Bright blue")
    --above is if you want it so when they join they go on that team. (Incase you don't have a script that sorts that out)
    p.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
            p.TeamColor = BrickColor.new("Bright red")
        end)
    end)
end)
Ad
Log in to vote
-2
Answered by
IcyEvil 260 Moderation Voter
10 years ago

No you failed an If and Then statement.

children = game.Players:GetChildren()

team1 = ("Bright blue")
team2 = ("Bright red")

children = team1 ("Bright blue")

if Player.Humanoid.Health == 0 then
    children = team2 ("Bright red")
end

I didnt see anything wrong other than that.

0
I can still see many flaws. You never accessed their teamcolor to change it to a BrickColor... Also, for line 8, you'd need a loop to repeat it because it needs to keep checking if they die. One more tip, sometimes, their health goes below 0 so it may be able to bypass line 8. Shawnyg 4330 — 10y

Answer this question