The problem I'm having is that whenever I set the players team to white, it doesn't set it. Help is needed D:
time = 0 -- For safety concerns while true do -- Loop timer so it works time = time + 1 print(time) function kill() -- Kill all players playerNames = game.Players:GetChildren()--Find the names of all the players for i = 1, #playerNames do ----repeat until all the players are killed game.Workspace[playerNames[i].Name].Humanoid.Health = 0 ----kill the player end ----finished end -- Ends the kill() function if time >= 30 then --Time for people to choose character kill() -- Runs the kill() function wait(20) --The game runs --RIGHT HERE playerNames = game.Players:GetChildren() ----Find the names of all the players playerNames.TeamColor = BrickColor.new("White") -- Sets all player's team to spectator kill() -- Runs the kill() function --RIGHT HERE time = 0 -- Resets the timer end -- Ends the "if" statement print(time) -- for debugging wait(0.9) -- Wait 1 second so it doesn't keep looping at hyperspeed until the game crashes end -- Ends the loop
You want to change team colors through a loop. Put this portion of script on line 17
for i=1, #playerNames do --So for every player, this runs each time. playerNames[i].TeamColor = BrickColor.new("White") --So based on index value (i) that player's team color changes. end
You see, with your script you were trying to change the TeamColor of a table. That's what GetChildren is, a table of values. So the players are a value, you want to change the value. So you change the value's team color to white through a loop.
I'm not quite sure what your time variable is supposed to be doing, but just remember, it is just a variable, so it's only a number within your script. I think, I have found the answer though
playerNames.TeamColor = BrickColor.new("White")
This is an old way of naming brick colors. I actually just mad the same mistake today, so this is how you do it properly
playerNames.TeamColor=BrickColor.White()
Hope this helps! If it doesn't, sorry. I'm still new to all of this stuff, but I hope I can help you as best as I can :D