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

Using a loop to change TeamColor?

Asked by 6 years ago
game.workspace.players.playersAlive.Changed:connect(function(newgame)
    local playersIngame = game.workspace.players.playersIngame.Value
    local playersAlive = game.workspace.players.playersAlive.Value
    local children = game.Players:GetChildren()
    print ('A player has died')
        if  playersAlive <= 1 
        and playersIngame >= 2 then 
            print ('A new round is to be started')
            wait (3)
                print ('Getting players')
                for i = 1, #children do
                print(i, children[i].Name)
                children.TeamColor = BrickColor.new("Really Black")
            end

Everything above is working the last line is working perfectly- Thank you for your help!

1 answer

Log in to vote
0
Answered by 6 years ago

I ended up figuring out the issue.

Here is the fix if anyone is interested!

game.workspace.players.playersAlive.Changed:connect(function(newgame)
    local playersIngame = game.workspace.players.playersIngame.Value
    local playersAlive = game.workspace.players.playersAlive.Value
    local children = game.Players:GetChildren()
    print ('A player has died')
        if  playersAlive <= 1
                and playersIngame >= 2 then 
            print ('A new round is to be started')
            wait (3)
                print ('Getting Players')
                for index, child in pairs(game.Players:GetChildren()) do
                child.TeamColor = BrickColor.new("Really black")
                end
                end
Ad

Answer this question