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

Using a loop to change TeamColor?

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

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

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