How do you make it so it gives the experience points to all the players at the same time while waiting (0.03125)? This script gives the experience to one person first, waits, then gives it to the next person. How can you make this happen without placing a script in every player. The script must be in Workspace. Thanks!
for _, player in pairs(game.Players:GetPlayers()) do for i = 1, player.leaderstats.Score.Value do player.PlayerGui.ScreenGui.ExperiencePointsIntValue.Value = player.PlayerGui.ScreenGui.ExperiencePointsIntValue.Value + 1 wait(0.03125) end end
You can just wrap the inner block with a coroutine.
for _, player in pairs(game.Players:GetPlayers()) do coroutine.wrap(function() for i = 1, player.leaderstats.Score.Value do player.PlayerGui.ScreenGui.ExperiencePointsIntValue.Value = player.PlayerGui.ScreenGui.ExperiencePointsIntValue.Value + 1 wait(0.03125) end end)() end
Now everything should happen (virtually) simultaneously on every player.
for i,v in pairs (game.Players:GetPlayers()) do v.PlayerGui.ScreenGui.ExperiencePointsIntValue.Value = v.PlayerGui.ScreenGui.ExperiencePointsIntValue.Value + 1 wait(0.03125) end