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

Can you please explain me why this isn´t working?

wait(7)
function doTeam()
local playerDir = game.Players:GetPlayers();
local chosen = table.remove(playerDir, math.random(1, #playerDir)); 
chosen.TeamColor = game.Teams["Bright red Team"].TeamColor;

for index,value in next, playerDir do
value.TeamColor = game.Teams["Bright blue Team"].TeamColor;
end

end

doTeam();

Also its in a normal script.

1 answer

✓ Accepted answer

What is the error? Have you run this in a test server?

From the information here, it seems that your script is correct. However, I'm guessing it's running at the wrong time.

This script will error in the event that there are no players joined at the time this script runs (which is seven seconds after server start).

Test using test servers and you will be able to find these things. The output is... sort of... necessary for you to program well.

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