Only 1 of player could teleport on TeleportToPrivateServer

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to teleport 2 players who matched.

  2. What is the issue? Only 1 player could teleport to the place, and other people got a message which is this.

This is what I wrote for teleporting.

local destinationPlaceId = 12345678
	
	local player1 = game.Players:GetPlayerByUserId(<UserID>)
	local player2 = game.Players:GetPlayerByUserId(<UserID>)
	
	local privateServerId = TeleportService:ReserveServer(destinationPlaceId)
	
	local teleportOptions = Instance.new("TeleportOptions")
	teleportOptions:SetTeleportData(player1.Name, player2.Name)

	TeleportService:TeleportToPrivateServer(destinationPlaceId, privateServerId, {player1,player2}, teleportOptions)

1 Like

Check if your place is public or published, check if https service is enabled. If everything correct try pcalling the function and using a separate tp to both like:

local destinationPlaceId = 12345678

local player1 = game.Players:GetPlayerByUserId(<UserID>)
local player2 = game.Players:GetPlayerByUserId(<UserID>)

local PlayersToTeleport = {player1,player2}

local privateServerId = TeleportService:ReserveServer(destinationPlaceId)

local teleportOptions = Instance.new("TeleportOptions")
teleportOptions:SetTeleportData(player1.Name, player2.Name)
for i,v in ipairs(PlayersToTeleport) do
    local s, r = pcall(function()
        TeleportService:TeleportToPrivateServer(destinationPlaceId, privateServerId, {v}, teleportOptions)
    end
    if s then
        print("TeleportSucess") -- if this didn't print 2 times just one player goes
    end
end

Try to use TeleportAsync with ReservedServerAccessCode turned on.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.