Can't get ReserveServer from serverscript (HTTP 403 (Forbidden))

I want to make lobby system by myself. It works pretty well, but the issue is. Whenever i get ReserveServer. It still giving me the error “HTTP 403 (Forbidden)” .

Here’s all line of codes:

-- change settings here

local maxplayers = 2
local maxtimer = 20
local placeID = 17267036049

-- other variables

local list = {}
local playerExistsInLobby = false
local teleportProcessing = false
local timer
local frame = script.Parent.SurfaceGui.Frame
local enterpart = script.Parent.Parent.waitingpoint
local cablecar_basepart = script.Parent.Parent.CableCar.Base

local replicatedstorage = game:GetService("ReplicatedStorage")
local teleportservice = game:GetService("TeleportService")

local teleportOptions = Instance.new("TeleportOptions")

local function updateplayer ()
	frame.PlayerNum.Text = #list .. "/" .. maxplayers
end

-- start values

frame.PlayerNum.Text = #list .. "/" .. maxplayers

-- running values


replicatedstorage.LeaveGuiEvent.OnServerEvent:Connect(function (player)
	for i = 1, #list do
		if list[i] == player.Character.Name then
			player.Character.Humanoid.Jump = true
			task.wait(.1)
			player.Character.HumanoidRootPart.CFrame = script.Parent.Parent.ExitLobbyPart.CFrame
			table.remove(list, i)
			if #list < 0 then
				playerExistsInLobby = false
				teleportProcessing = false
			end
			updateplayer()
		end

	end
end)


-- when touches a wall

script.Parent.Touched:Connect(function (hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if teleportProcessing == false then
			local char = hit.Parent
			local players = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
			local playerenter = false
			-- do things here and check the teleport process or max players

			for i = 1, #list do
				if list[i] == char.Name then
					playerenter = true
				end
			end
			if playerenter == false then
				if #list < maxplayers then
					table.insert(list, char.Name)

					char:FindFirstChild("HumanoidRootPart").CFrame = enterpart.CFrame

					updateplayer()

					print(list)
					
					replicatedstorage.LeaveGuiEvent:FireClient(players, true)
					
					for i = 1, #list do
						if #list >= 1 then
							if list[i] == char.Name then
								playerExistsInLobby = true
							end
						else
							playerExistsInLobby = false
						end
					end
				end
				
				-- check if player left then remove character name from the table
				game:GetService("Players").PlayerRemoving:Connect(function (plrWhoGetsRemovedOrLeft)
					if plrWhoGetsRemovedOrLeft.Name == char.Name then
						for i = 1, #list do
							if list[i] == plrWhoGetsRemovedOrLeft.Name then
								table.remove(list, i)
								updateplayer()
								
								print(#list , list[1] , list[2])
								
								if teleportProcessing == true then
									if #list <= 0 then
										teleportProcessing = false
									end
								end
							end
						end
					end
				end)
				
				-- check if player die or removed then remove character name from the table
				players.CharacterRemoving:Connect(function (charWhoGetsRemovedOrDied)
					if charWhoGetsRemovedOrDied.Name == char.Name then
						for i = 1, #list do
							if list[i] == charWhoGetsRemovedOrDied.Name then
								table.remove(list, i)
								updateplayer()

								print(#list , list[1] , list[2])
								
								if teleportProcessing == true then
									if #list <= 0 then
										teleportProcessing = false
									end
								end
							end
						end
					end
				end)
			end
		end
		
	end
	
end)


while task.wait() do
	for i = 1, maxtimer do
		timer = maxtimer - i
		frame.Timer.Text = timer
		task.wait(1)
	end
	
	if #list > 0 then
		if playerExistsInLobby == true then
			teleportProcessing = true
			frame.Status.Text = "Teleporting"
			for i = 1, #list do
				if list[i] then
					local player = game:GetService("Players"):FindFirstChild(list[i])
					
					-- runs when player is exist and being teleported
					
					replicatedstorage.LeaveGuiEvent:FireClient(player, false)
					
					task.wait(5)
					
					
					teleportservice:TeleportToPrivateServer(placeID,teleportservice:ReserveServer(placeID), player)
					
					task.wait(5)
					
					teleportProcessing = false
				end
			end
			repeat task.wait() until not teleportProcessing
			frame.Status.Text = "Ready"
			
			playerExistsInLobby = false
			for i = 1, #list do
				if list[i] then
					table.remove(list, i)
					updateplayer()
				end
			end
			
		end
	end
end

Here’s the short line of code of the issues.

for i = 1, #list do
				if list[i] then
					local player = game:GetService("Players"):FindFirstChild(list[i])
					
					-- runs when player is exist and being teleported
					
					replicatedstorage.LeaveGuiEvent:FireClient(player, false)
					
					task.wait(5)
					
					
					teleportservice:TeleportToPrivateServer(placeID,teleportservice:ReserveServer(placeID), player)
					
					task.wait(5)
					
					teleportProcessing = false
				end
			end

I’ve tried using TeleportOptions and get the Reserve Server. Which didn’t work aswell.

ReserveServer returns a tuple, have you tried passing just the access code into TeleportToPrivateServer?

Hello!

I’m not the best at Teleportservice and ReserveService, I’ve tried so many times to make an Elevator Lobby Teleporter, but I didn’t succeed :frowning:

I tried to solve your error.

Try inserting this part of code into the code:

local accessCode = teleportservice:ReserveServer(placeID)
        teleportservice:TeleportToPrivateServer(placeID, accessCode, player)

Here’s the code:

local teleportservice = game:GetService("TeleportService")
local placeID = 17267036049

-- the rest of the code

for i = 1, #list do
    if list[i] then
        local player = game:GetService("Players"):FindFirstChild(list[i])
        
       
        
        replicatedstorage.LeaveGuiEvent:FireClient(player, false)
        
        task.wait(5)
        
        local accessCode = teleportservice:ReserveServer(placeID)
        teleportservice:TeleportToPrivateServer(placeID, accessCode, player)
        
        task.wait(5)
        
        teleportProcessing = false
    end
end

The local accessCode = teleportservice:ReserveServer(placeID) line reserves a server for teleportation and returns an access code. The teleportservice:TeleportToPrivateServer(placeID, accessCode, player) line teleports the player to the reserved server using the access code

Also make sure you have enabled from:Settings->Security-> Allow Third Party Teleports and
Allow HTTP Requests

The option “Allow Third Party Teleports” controls whether or not players may teleport to other third-party experiences. Players can visit various games by using the teleportation features when they are activated.

“Allow HTTP Requests” is a setting that controls whether the game’s servers can send requests to remote servers using the HttpService. Enabling this setting allows the game to communicate with external APIs and retrieve data from the internet.

Also,please check those really useful links:

TeleportService
TeleportAsyncResult
TeleportOptions

1 Like

Thanks for the help. I realize that I didn’t turn on Third Party Teleports and maybe allow HTTP request too.

1 Like

TeleportService will not reserve nor teleport to another server in studio

1 Like

Yeah,please enable Allow HTTP Requests too!So the events can work

1 Like