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

How do I make everyone's team change?

Asked by 10 years ago

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()
0
What does "HIT" refer to? Kozero 120 — 10y

1 answer

Log in to vote
1
Answered by
MrNicNac 855 Moderation Voter
10 years ago

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.

Ad

Answer this question