I thought this script was suppose to go through all players, and insert each one into the table. Then, after all of them are inserted, it teleports all the players in the table. Is there a reason why its not? If so, could you explain? Note, I'm going to change this later, to not teleport all players, but just certain ones. Code:
local remote = game.ReplicatedStorage.StartEvent
remote.OnServerEvent:Connect(function(player)
for i, v in pairs(game.Players:GetPlayers()) do
local gameplaceid = 3313994275
local Player = player
local PlayersToTeleport = {}
local AlreadyInTable = false
for _,OtherPlayer in next,PlayersToTeleport do
if OtherPlayer == Player then
AlreadyInTable = true
end
end
if not AlreadyInTable then
table.insert(PlayersToTeleport,Player)
end
local TeleportService = game:GetService("TeleportService")
local Reserve = TeleportService:ReserveServer(3313994275)
TeleportService:TeleportToPrivateServer(3313994275, Reserve, PlayersToTeleport)
end
end)
