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

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

Asked by 9 years ago
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

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

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.

Ad

Answer this question