Problem with teleporting to reserved server

Hello, I have been trying to reserve a server for another place in my game and it is saying that my access code is invalid.

Any help would be appreciated, thanks!

local TPS = game:GetService("TeleportService")
local debounce = false

script.Parent.Touched:Connect(function(hit)
	local hum = hit.Parent:FindFirstChild("Humanoid")
	local plr
	if hum then
		plr = game.Players:GetPlayerFromCharacter(hum.Parent)
	end
	if plr then
		if debounce == false then
			debounce = true
			local code = TPS:ReserveServer(3934008719)
			print(code)
			TPS:TeleportToPrivateServer(1329347510,code,{plr})
			wait(1)
			debounce = false
		end
	end
end)
5 Likes

Please include the code you are using to perform the teleport. It is incredibly difficult for us to assist you if we don’t know what you’re doing.

4 Likes

Sorry, I forgot about that. I added it to the post.

2 Likes

I’m pretty sure the Ids have to be the same. Examine this sample code from the Hub:

local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local code = TS:ReserveServer(game.PlaceId) -- Returns a code
local players = Players:GetPlayers() -- Get a list of all players
TS:TeleportToPrivateServer(game.PlaceId,code,players) -- Actually teleport the players
-- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen

Also, please consider reading the API reference for this.

1 Like

You are reserving a server for a place with an ID of 3934008719 and teleporting to a place with an ID of 1329347510

To fix this, you must make sure both IDs match.

local destinationPlace = 1329347510
...
local code = TPS:ReserveServer(destinationPlace)
print(code)
TPS:TeleportToPrivateServer(destinationPlace,code,{plr})
4 Likes

I fixed the IDs to match, now the script doesn’t do anything.

It is showing “HTTP 400 Bad Request”.

1 Like

Which ID are you using? One of your IDs redirects to Catalog - Roblox

I went into the game explorer and right clicked the place and pressed “copy place id”

How should I be getting the place ID?

Are you trying to teleport in Studio or in the real game?

I’m trying to teleport in the real game.

Hmm, can’t see to figure this out. I tried your script in my game, edited it, it just gets stuck on Line 13 (the ReserveServer line). Sorry that I couldn’t help!

1 Like