I’ve been trying to figure out why teleport service only teleports some of the players to a private game but others get the “restricted place” error. Do not suggest publishing the game as I have done that hundreds of times.
The code in question:
local tpOptions = Instance.new("TeleportOptions")
tpOptions.ShouldReserveServer = true
local r, s = pcall(function()
return game:GetService("TeleportService"):TeleportAsync(placeId, plrTable, tpOptions)
end)
print(r)
print(s)
“plrTable” is a table containing player objects. “placeId” is the placeId for the destination.
Would you be able to send over all of your code?
If not, you can try implementing this function I have created, as I see you’re trying to reserve a server for players.
local TeleportService = game:GetService("TeleportService")
local function TeleportPlayersReservedServer(Players: {Player})
local ReservedServer = TeleportService:ReserveServer(game.PlaceId)
TeleportService:TeleportToPrivateServer(game.PlaceId, ReservedServer, Players)
end
Also, if you are being teleport to a different place, change the “game.PlaceId”.
I made some more debugging statements to your script, tell me if this helps or not.
local tpOptions = Instance.new("TeleportOptions")
tpOptions.ShouldReserveServer = true
local r, s = pcall(function()
return game:GetService("TeleportService"):TeleportAsync(placeId, plrTable, tpOptions)
end)
if r then
print("Teleport successful")
else
warn("Teleport failed: " .. s)
for _, player in ipairs(plrTable) do
local success, err = pcall(function()
return game:GetService("TeleportService"):TeleportAsync(placeId, {player}, tpOptions)
end)
if success then
print("Successfully teleported player: " .. player.Name)
else
warn("Failed to teleport player: " .. player.Name .. " due to: " .. err)
end
end
end