TeleportService "Attempted to teleport to a restricted place" Error

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.

Help would be greatly appreciated.

5 Likes

Do you have “allow third party teleports” enabled?

yes i do! I’ve tried this as my first fix and it did nothing… :frowning:

Try this

local tpOptions = Instance.new("TeleportOptions")
tpOptions.ShouldReserveServer = true
tpOptions.ReservedServerAccessCode = game:GetService("TeleportService"):ReserveServer(placeId)
									
local r, s = pcall(function()
	return game:GetService("TeleportService"):TeleportAsync(placeId, plrTable, tpOptions)
end)
	
print(r)
print(s)

tried this and it resulted in the same exact errors below:
image

2 out of the 4 people who were testing did not get teleported.

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”.

tried this exactly and did not work in the slightest, only 2 people got teleported once again.

weird thing - it’s always the same 2 people who dont get teleported, unsure on why

Would you be able to send all of your teleport functions and the places where they are called?

1 Like

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