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

Can someone help me with this?

 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

✓ Accepted answer

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)

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