local gameFunction = coroutine.create(function(player)
gameEvent:FireClient(player)
end)
for _, player in pairs(game.Players:GetPlayers()) do
if player then
coroutine.resume(gameFunction, player)
gameInPlay = false
wait(5)
player.TeamColor = BrickColor.new("White")
local playerFolder = player:WaitForChild("PlayerFolder")
if playerFolder then
local team = playerFolder:WaitForChild("Team")
if team then
team.Value = "White"
end
end
end
end
What I have this script do is get the players in the server, and then fire an event. The reason I have a wait(5) is because the event that is fired leads to something in the local script which has a v in it also, so the wait(5) MUST stay. The problem I am having is it is not firing at the same time for each player.
I believe the problem is that it is going through each player, so it fires the event for Player1, waits 5, then fires for Player2. Is there a way to fire for every player in the server so the event is fired at the exact same time, and they all go back to TeamColor White at the exact same time?

2 comments
It isn't firing at the same time because of the wait. Use a coroutine if you can. http://wiki.roblox.com/index.php?title=Beginners_Guide_to_Coroutines
Editted with what I have. It now only fires for one player