ReserveServer. HTTP 400 (Bad Request)

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!
    I need to teleport player to a private place.

  2. What is the issue? Include screenshots / videos if possible!
    badrequest

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

local teleportEvent = game.ReplicatedStorage:WaitForChild("TeleportEvent")
local teleportService = game:GetService("TeleportService")

local PLACE_ID = 12553308618

local code = teleportService:ReserveServer(PLACE_ID)

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

local deb = false

local function acceptSignal(player)
	if not deb then
		deb = true
		
		teleportService:TeleportAsync(PLACE_ID, {player}, teleportOptions)
		
		wait(10)
		
		deb = false
	end
end

teleportEvent.OnServerEvent:Connect(acceptSignal)

Here is how i solved this problem:

My problem was that I was trying to teleport the player to a completely different place.

First of all, I created a new place in “Asset Manager”.

teleprt

Then I published the place that I need for teleportation to the newly created one.
I also had to change my script a bit.

local teleportEvent = game.ReplicatedStorage:WaitForChild("TeleportEvent")
local teleportService = game:GetService("TeleportService")

local PLACE_ID = 12695897147

local code = teleportService:ReserveServer(PLACE_ID)

local deb = false

local function acceptSignal(player)
	if not deb then
		deb = true
		
		teleportService:TeleportToPrivateServer(PLACE_ID, code, {player})
		
		wait(10)
		
		deb = false
	end
end

teleportEvent.OnServerEvent:Connect(acceptSignal)

Before that, I used the TeleportAsync() method. And in the rewritten script: TeleportToPrivateServer().

1 Like

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