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 make everyone's team change?

So this is a script I threw together, after looking around Scripting helpers, but I don't think it works. Could someone show me what I did wrong?

if game.Players:FindFirstChild(HIT.Parent.Name)
	.TeamColor=="[DeepOrange]" 
	then
	
function MoveToDeepOrange()
    for _,Player in pairs(Game.Players:GetPlayers()) do
    --Looping through all players
        Player.TeamColor = BrickColor.new("Deep Orange")
            --Change Team color
        Player.CharacterAdded:wait() --Make sure they are alive first
        Player.Character.Humanoid.Died:connect(function()
            --When they die
            Player.TeamColor = BrickColor.new("Mid gray")
                    --Change back to red
        end)
    end
end

MoveToDeepOrange()

2 comments

0

What does "HIT" refer to?

1 answer

✓ Accepted answer

Here's a function that will loop through all players and make every one of them change to a specific TeamColor. An example of using it is below the source.

function ChangeAllTeamColor(NewTeamColor)
	for i,v in pairs(Game.Players:GetPlayers()) do
		v.TeamColor = BrickColor.new(NewTeamColor);
	end
end

Anywhere in development code, you use the function like this:

ChangeAllTeamColor("Really blue")

Just by doing that, every player's TeamColor will change to Really blue.

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