Hello developers,
So i encountered this error where it cannot pass through a for i loop. Im not so sure why but it looks like it only lets 1 person through and then breaks with this error message:
Heres the code:
local function teleportPlayers()
if #list > 0 then
teleporting = true
local playersToTeleport = {}
local teleportTime = 0
local code = TS:ReserveServer(placeId)
for i=1,#list do
if game.Players:findFirstChild(list[i]) then
table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
local char = game.Players:findFirstChild(list[i]).Character
local person = game.Players:findFirstChild(list[i])
print(playersToTeleport)
if char then
char:MoveTo(game.Workspace.tptogameRoomPart.Position)
end
TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
removeFromList(char)
else
table.remove(list,i)
end
end
game.ReplicatedStorage.Events.TeleportToGame:Fire(playersToTeleport, code, placeId)
teleporting = false
list = {}
if maxplramt.Value > 1 then
timer = 15
else
timer = 10
end
end
end