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

How do i execute a change team script?

how can i make this script work

function checker()
c = game.Players:GetChildren()
	for num, obj in pairs(c) do
		if obj.Character.Humanoid.Health == 0 then
	    if obj.Teamcolor == BrickColor.new("Bright blue") then 
			obj.Teamcolor =  BrickColor.new("Bright red")	

checker() -- this to loop the checking	
end
end
end
wait() --  this is to loop the checking
checker()
end
checker()

1 answer

✓ Accepted answer
Game.Players.PlayerAdded:connect(function(Player) --Use events for efficiency. When the  player joins,
    Player.CharacterAdded:connect(function(Character) --When they respawn,
        Character.Humanoid.Died:connect(function() --When they die
            if Player.TeamColor == BrickColor.new("Bright blue") then --If they are on the Bright blue team when they die,
                Player.TeamColor = BrickColor.new("Bright red") --Put them on the red team.
           end
        end)
    end)
end)
    

1 comment

0

ill try and see if it works now

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