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

Can someone help me with this?

Asked by
Yeevivor4 155
10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
 game.Players.PlayerAdded:connect(function (player)
    player.CharacterAdded:connect(function (character)
         play = game.Players:GetChildren()
          for i = 1,#play do
 if play[i].TeamColor == BrickColor.new("Bright blue" or "Bright red")  then
   if play[i] ~= nil then
    play[i].TeamColor = BrickColor.new("Mid Gray")

               end
           end
       end

I was wondering if this code works. I was just trying to play around with the respawned code. What I'm trying to do is that If someone dies, their team becomes Mid Gray instead of staying at Bright blue or Bright red.

Thank you for reading.

1 answer

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

Well, you're on the right track. I also want to give you this note that if you have a script that teams them back when the round is over, you might want to teleport them instead of respawning since it'll interfere with this.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        if player.TeamColor == BrickColor.new("Bright blue") or player.TeamColor == BrickColor.new("Bright red") then
            player.TeamColor = BrickColor.new("Mid gray") -- I'm sure it's a lower case g. Correct me if I'm wrong.
        end
    end)
end)
Ad

Answer this question