Attempt to teleport to a place that is restricted

I am trying to create a server creation system and In the main place for the game, I have ‘sub-places’ that are ALL PUBLIC AND PUBLISHED but I still seem to get the same error every single time.

I am trying to teleport to the selected place.
image

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I run this code here on the server:

--//
local teleportService = game:GetService("TeleportService")

--//
local thisPlaceId = game.PlaceId
local targetPlaceId = 11855234327

--//
function teleport(players)
	local accessCode = teleportService:ReserveServer(thisPlaceId)

	teleportService:TeleportToPrivateServer(targetPlaceId, accessCode, {players})
end

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
	teleport(player)
end)

It returns with this:
image

1 Like

Instead of TeleportToPrivateServer, try

TeleportAsync 

or,

TeleportPartyAsync