1. What do you want to achieve?

I want to make it so that when the player touches a part in the Workspace, it will reserve a private server in a different game and teleport them to the game in that private server.

  1. What is the issue?

However, when ReserveServer is created it just gives me different errors (shown in the screenshots below). The issue is to do with reserving the server, which is the line that the error is pointing to.

https://gyazo.com/cbd2423468d88a964307eb72cda29625 (In-game)

https://gyazo.com/7f370ae18e40d5d3eacd56f07ad4ffe6 (In studio)

Please don't tell me the error is because I haven't been testing this in-game, I have,

  1. What solutions have you tried so far?

The solutions I have tried so far have been a variety, I have asked questions on ScriptingHelpers similar and also on here, the Roblox dev forum, but still nothing seems to give me the answer. I'm starting to question whether this just be a bug with my game, because I simply can't figure it out. Below I have provided the script (I will indicate the line which seems to be causing the problem)

Another thing that I would like to add is that everything is correct, HTTPs requests are on the same as both the Roblox API on both games. Both of the games are also on public.

Server script:

local debounce = false
local teleportServerID = 4861707716

script.Parent.Touched:Connect(function(hit)
	local human = game.Players:GetPlayerFromCharacter(hit.Parent)
	if human then
		if not debounce then
			debounce = true
			print("Hello")
			local reserve = TeleportService:ReserveServer(4861707716) -- Problem line
			TeleportService:TeleportToPrivateServer(teleportServerID, reserve, human)
			print("Hello")
			wait(2)
			debounce = false
		end
	end
end)

(I'll post both scripts, one with the reserve server line inside the block of code and the other one below is with the reserve server outside of the event, both cause the same problem.

local debounce = false
local teleportServerID = 4861707716
local reserve = TeleportService:ReserveServer(4861707716)

script.Parent.Touched:Connect(function(hit)
	local human = game.Players:GetPlayerFromCharacter(hit.Parent)
	if human then
		if not debounce then
			debounce = true
			print("Hello")
			TeleportService:TeleportToPrivateServer(teleportServerID, reserve, human)
			print("Hello")
			wait(2)
			debounce = false
		end
	end
end)

I hope this helps, I'll accept any answers that work.

2 comments

0

If you're trying to reserve and teleport in studio, then it will throw an error. TeleportService only works in live servers.

0

I clearly said that I've been testing it in Roblox player.