My code is supposed to teleport all players at once into the map but instead is only teleporting one player each with a three second period of time in-between. I've been trying to fix this forever now please help
local rand = math.random(1, #maps) --chooses random map
local map = maps[rand]:Clone() --clones map
map.Parent = workspace --places map in workspace (loads map)
local barrier = map.barrier --find barrier
local mapname = map.MapName.Value
status.Value = "Next map : "..mapname --sets status to map name
wait(4)
status.Value = "Teleporting players..." --warns players
wait(2)
local players = game.Players:GetChildren() --gets all players ingame
for i = 1,#players do
players[i].Character.Humanoid.WalkSpeed = 0
if players[i].Character ~= nil then
local spawnLocation = math.random(1,#workspace.Teleports:GetChildren()) --finds pos
players[i].Character:MoveTo(workspace.Teleports:GetChildren()[spawnLocation].Position) --teleports player
players[i].Character.Parent = workspace.Ingame --sets player to ingame folder
status.Value = "Get ready!"
wait(2)
barrier.CanCollide = false -- open walls
status.Value = "Go!"
players[i].Character.Humanoid.WalkSpeed = 16
wait(1)
end
end
