Unable to teleport to a Reserved server using TeleportService:ReserveServer

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    To teleport a player to a Reserved server

  2. What is the issue? Include screenshots / videos if possible!
    Whenever I load into game on roblox, I get this error:
    Unable to Cast String to int64

But whenever Im in studio, I get HTTP 403 (Forbidden)

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

I’ve tried Enabling HTTP requests, I’ve also tried to use a pcall but nothing has worked

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local event = game:GetService("ReplicatedStorage"):WaitForChild("Teleport")
local teleportService = game:GetService("TeleportService")
local placeId = nil
local players = game:GetService("Players")
local player = players:GetPlayers()[1]

event.OnServerEvent:Connect(function(player, chapterNumber)
	if chapterNumber == 1 then
		placeId = 15384706941

		local reservedserver = teleportService:ReserveServer(placeId) --This gives the player a reserved server to go to

		teleportService:TeleportAsync(reservedserver, {player})
	end
end)

It was working fine when teleporting to a regular server, but all of a sudden its decided to mess up now.

P.S: The chapter number is sent through the remote event from the client, I’m making a horror game and Im using an integer to determine which place to teleport to.

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Nevermind, i was able to make it work with a Teleport option instance.

If anyone else is struggling with this, this is the code that I used.

local event = game:GetService("ReplicatedStorage"):WaitForChild("Teleport")
local teleportService = game:GetService("TeleportService")
local placeId = nil
local players = game:GetService("Players")
local player = players:GetPlayers()[1]

local teleportOptions = Instance.new("TeleportOptions")
teleportOptions.ShouldReserveServer = true

event.OnServerEvent:Connect(function(player, chapterNumber)
	if chapterNumber == 1 then
		placeId = 15384706941

		teleportService:TeleportAsync(placeId, {player}, teleportOptions)
	end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.