You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to teleport 2 players who matched.
-
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)
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, , teleportOptions)
end
if s then
print("TeleportSucess") -- if this didn't print 2 times just one player goes
end
end