403 (forbidden) error when using Teleport Service

Hi

I am making a story game and I’m trying to make the system where all players in a ring will load into the same server instance. I believe I use this using TeleportService:ReserveServer(). When I do this I get a 403 forbidden error.

local test = TeleportService:ReserveServer(13128332027)

image

You are not trying to teleport inside Studio right? cause that wont work, test it in real game.

And you should check what ReserveServer does in the documentation.

When you create a Reserved Server, you get a Password and a Server ID, and you should supply the password into the TeleportAsync() function and using Teleport parameters:

If you are teleporting players to a place inside your game, you dont need to enable ThirdPartyTeleports, and HTTP requests is not related with the Teleport function.

Hi. Thanks for replying

I tested it in the game and now when it tries to teleport me I get this message:
image

Yeah, thats what I meant. You are supplying the password or not? you should show your code

TeleportService:TeleportToPrivateServer(13128332027, AccessCode, players)

Yeah, but I mean the rest of the code. Like the example in the documentation:

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

local code = TeleportService:ReserveServer(game.PlaceId)

local players = Players:GetPlayers()

TeleportService:TeleportToPrivateServer(game.PlaceId, code, players)
-- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen
local PlayerCount = script:WaitForChild("PlayerCount")
local TeleportService = game:GetService("TeleportService")
local players = {}

local db = false

Time.Value = 30
PlayerCount.Value = 0

local function startTimer()
	
	coroutine.resume(coroutine.create(function()
		while true do

			wait(1)

			Time.Value -= 1
			
			if Time.Value <= 0 then
				
				local AccessCode = TeleportService:ReserveServer(13128332027)
				print(AccessCode)
				
				for i,v in pairs(game:GetService("Players"):GetChildren()) do
					
					if v:WaitForChild("HasJoined").Value == true then
						
						table.insert(players, v)
						
					end
					
				end
				
				TeleportService:TeleportToPrivateServer(13128332027, AccessCode, players)
				
				break
				
			end

		end
	end))
	
end

PlayerCount.Changed:Connect(function(val)
	
	if val > 0 and db == false then
		
		db = true
		
		startTimer()
		
	end
	
end)```

Well. I tested your code. And I experienced a weird bug…

First, I edited your code very little just for debugging.
It works for me, I got teleported to a reserved server normally.

BUT… I got this weird bug which doesnt allow to teleport to any place, no matter if you do the most basic Teleport function, its impossible to Teleport…
Steps I remember:

  • To test your code, I created a new baseplate, I added a script in ServerScriptService
  • Used this code (which works) in that script.
  • Created a new SubPlace in Asset Manager > Places
  • NOT Opened the SubPlace and Published it
  • I did set the PlaceID of the teleport function to the new SubPlace ID.
  • Published Main Place.
  • And Play in real Server in Roblox.

Result:

  • The ReserveServer function gaves me “Unknow Error” warning
  • When I ran the most basic Teleport code from Developer Console while in game, seems like the place doesnt exist.
  • It was not possible to Teleport in any way to the SubPlace

But… Then, I created a new baseplate again, did almost similar steps, I tested in real game and it works normally, the ReservedServer and ofc the normal Teleport…

Then I went to the first Baseplate I made, opened the Subplace, Published it, and that Baseplate starting to work normally.


So my suggestion is, if your code still not working merge a new place with your systems and stuff. Remember I edited it a little just for testing, check it:

local PlayerCount = script:WaitForChild("PlayerCount")
local TeleportService = game:GetService("TeleportService")
local players = {}

local db = false

local Time = script:WaitForChild("Time") -- I suppose you already have this line
Time.Value = 15
PlayerCount.Value = 0

local PlaceID = 13128332027

local function startTimer()
	coroutine.resume(coroutine.create(function()
		while true do
			wait(1)
			
			Time.Value -= 1
			print(Time.Value)

			if Time.Value <= 0 then
				warn("Teleporting")
				
				for i,v in pairs(game:GetService("Players"):GetPlayers()) do
					if v:FindFirstChild("HasJoined") then
						if v.HasJoined.Value then
							table.insert(players, v)
						end
					end
				end
				warn(players)
				
				local AccessCode = TeleportService:ReserveServer(PlaceID)
				warn(AccessCode)

				TeleportService:TeleportToPrivateServer(PlaceID, AccessCode, players)

				break
			end
		end
	end))
end

-- I added this for testing
game.Players.PlayerAdded:Connect(function(plr)
	local bool = Instance.new("BoolValue")
	bool.Name = "HasJoined"
	bool.Value = true
	bool.Parent = plr
end)

-- I removed the conditions for testing
startTimer()

Hi

I appreciate all the help. I fixed the issue but it turns out it was a small mistake. I only published the main place not the sub place. Thanks

1 Like

The experience is private, try making it public.

thanks for the help! It worked successfully

1 Like

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