I need to be able to send a GUI to all of the Players on a team. This is what I have so far.
players = game.Players:GetChildren() for i=#players,1 do if game.Players[i].TeamColor == game.Teams["My Team"].TeamColor then gui = script.Parent.alarm_gui:clone() gui.Parent = game.Players[i].PlayerGui end end
However it errors out here:
if game.Players[i].TeamColor == game.Teams["My Team"].TeamColor then
The Output says "1 is not a Valid member of Players"
Looks fine as far as I can tell, except line 2. For loops require that the lesser number goes last, so it should be:
for i = 1, #players do
Another thing is that you're trying to refer to a table that doesn't exist when you say game.Players[i]. Since the loop is going through the players table you have already defined, it should be players[i].TeamColor, for instance.
Also, it's :Clone(), not clone(). That was just bugging me, it's really just proper syntax :P