Teleport several players to THE SAME private server (pls help)

So I have this code. It does teleport all the players but it teleports them to different private servers. Is there a way to fix that?

-- server script in ServerScriptService

local TS = game:GetService("TeleportService")
local Part = workspace["Elevator 2p left"].Teleport.Telepart

workspace["Elevator 2p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 2p left"].Teleport.Telepart end)
workspace["Elevator 3p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 3p left"].Teleport.Telepart end)
workspace["Elevator 4p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 4p left"].Teleport.Telepart end)
workspace["Elevator 5p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 5p left"].Teleport.Telepart end)
workspace["Elevator 6p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 6p left"].Teleport.Telepart end)
workspace["Elevator 1p left"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 1p left"].Teleport.Telepart end)

workspace["Elevator 2p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 2p"].Teleport.Telepart end)
workspace["Elevator 3p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 3p"].Teleport.Telepart end)
workspace["Elevator 4p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 4p"].Teleport.Telepart end)
workspace["Elevator 5p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 5p"].Teleport.Telepart end)
workspace["Elevator 6p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 6p"].Teleport.Telepart end)
workspace["Elevator 1p"].Teleport.Telepart.Touched:Connect(function() local Part = workspace["Elevator 1p"].Teleport.Telepart end)

local TPS = game:GetService("TeleportService")
local Players = game:GetService("Players")

-- SAFE TELEPORT MODULE
local SafeTeleport = require(game:GetService("ServerScriptService"):WaitForChild("SafeTeleport"))

local idPlace = 11873076445


-- RESERVED SERVER DATA
local code
local pvSVid

-- DEBOUNCE IF SERVER ALREADY EXIST
local isServerExist = false

-- PLAYERS WHO ALREADY TRIGGERED THE TOUCH
local PlayersActivatedTouchTP = {}

function private(partTouched)
	if partTouched.Name == "HumanoidRootPart" then
		local isPlayer = Players:GetPlayerFromCharacter(partTouched.Parent)
		if isPlayer then
			if not table.find(PlayersActivatedTouchTP, isPlayer) then
				table.insert(PlayersActivatedTouchTP, isPlayer)
				if Players:GetPlayerByUserId(isPlayer.UserId) then
					if not isServerExist then
						code, pvSVid = TPS:ReserveServer(idPlace)
						isServerExist = true
					end		
					if code and pvSVid then
						local teleportOptions = Instance.new("TeleportOptions")
						teleportOptions.ReservedServerAccessCode = code

						local isTPDone, TPresult = SafeTeleport(idPlace, {isPlayer}, teleportOptions)
						if isTPDone then
							table.remove(PlayersActivatedTouchTP, table.find(PlayersActivatedTouchTP, isPlayer))
						end
						warn("TP done?", isTPDone)
						warn("PrivateServerId?", TPresult.PrivateServerId)
						warn("ReservedServerAccessCode?", TPresult.ReservedServerAccessCode)
					end
				end					
			end
		end
	end
end

workspace["Elevator 2p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 3p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 4p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 5p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 6p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 1p left"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 2p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 3p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 4p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 5p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 6p"].Teleport.Telepart.Touched:Connect(private)
workspace["Elevator 1p"].Teleport.Telepart.Touched:Connect(private)
local players = {PLAYERS_IN_CHARGE}
local PlaceID = PLACE_ID

TeleportService:TeleportToPrivateServer(PlaceID , TeleportService:ReserveServer(PlaceID), players)

Here is the documentation about Teleport Service:
https://create.roblox.com/docs/reference/engine/classes/TeleportService

I wish this help!

I’ve already read the doc but I don’t get it.

Use my code. That is how you teleport a table of players into a private server of a game

Well, how do I add players who touch the part to the list then?

table.insert

As a conclusion, you can use
table.insert(table, player)

1 Like