Reserve Server - HTTP 403 (Forbidden)

I am using the teleport service to reserve servers and it keeps throwing the same error.
image

I am aware that you cannot teleport while in roblox studio, but the http 403 error shouldn’t be there.
Secondly I have enabled all the required settings needed to use the teleport service.
Lastly I am using a server script.

Does anyone have any idea what could be causing this?

1 Like

Test in a live server. Does the error persist?

Yes it still does throws the http 403 error.

Can you post your code? It’d be helpful to finding the root cause of the issue.

local TeleportService = game:GetService("TeleportService")
local PlaceId = 73534054

game.ReplicatedStorage.new.OnServerEvent:Connect(function(player)
	local code = TeleportService:ReserveServer(PlaceId)
	wait()
	TeleportService:TeleportToPrivateServer(PlaceId, code, {player})
end)
  1. The wait() function is deprecated.
  2. Why are you using wait()…? You’re unnecessarily yielding. ReserveServer is a yielding function itself, and the stack will be paused until the reserved server is ready for use.
  3. You’re recommended to use the new TeleportService:TeleportAsync(); it’s supposed to be the one-stop shop for all of your teleportation needs.

You want to create a reserved server in place 73534054, and then teleport the player to said reserved server. TeleportAsync can do that!

TeleportAsync accepts a parameter of teleport options, which are created using the TeleportOptions instance.

local teleportOptions = Instance.new(“TeleportOptions”)
teleportOptions.ShouldReserveServer = true

You should be able to figure out the rest. Try using this instead of ReserveServer and see if your problem’s resolved.

2 Likes

Wait() is deprecated? What do you mean?

wait() runs at a halved frequency, which can cause unexpected bugs in some use cases. The new task library includes a task.wait() function which runs on the Heartbeat engine, and is now recommended for use cases where you need to wait a fixed amount of time.

Oh ok, didn’t know that. Thanks for the clarification. Does this mean that using wait() will result in errors?

No. wait() is perfectly fine in most use cases, but in new code you should use task.wait. Don’t panic to replace all instances of wait() in old code

1 Like

Ok good, I don’t want to change all my previous waits into task.wait.

In regards to this suggestion, It is correct.

I’ve looked high and low for a straight forward answer as to how to use TeleportAsync() to teleport players to a reserved server without getting the HTTP 403 error.
It turns out there is a simple explanation;
which is why I’m here to explain and hopefully nobody else will struggle to find this information again.

Supposing you are teleporting from ‘Place A’ too ‘Place B’;
there are a couple checks you can do:

Check #1:
See if the error fires in a live session after
Committing your teleport scripts, Publishing the game, and Launching the game from the Roblox browser (Not from Roblox Studio).
Once in ‘Place A’ open the Console (press F9) and select the Server Tab on the top right.
If the error does Not show up in the live session, that’s great!

Tip: To ensure your script is running and the error is not firing, you can try surrounding the broken line with print statements. If the prints show up and nothing appears between the two prints then you should be good.

Example: (ServerScript in Place A)

print("before error")
	TeleportService:TeleportAsync(placeId_B,  {player},  teleportOptions)  --This line through the error for me.
print("after error")

Good Output:

-- before error
-- after error

Bad Output:

-- before error
-- ⚠ HTTP 403 (Forbidden)

Check #2:
Add a ServerScript in ‘Place B’ that prints the game.PrivateServerId.
if the PrivateServerId is a blank string (A.K.A “” ) then you are in a public server.
if PrivateServerId is Not blank then your server is a private or reserved server.

Example: (ServerScript in Place B)

if game.PrivateServerId == "" then
	print("This is a Public Server.")
else
	print("This is a Reserved Server.")
end
print("reservationID =", game.PrivateServerId)

Your PrivateServerId may look something like this:
-- reservationID = 013ee84b-c3cc-483a-8a37-d2ed3eaa1cffe

1 Like