TeleportToPrivateServer doesnt teleport

Hello everyone, I’m having problems with my new game just 24 hours after opening it to the public (before it cost 100 robux to get in because it was a closed beta).

1 - The first problem is that it simply takes too long to get into the game. It shows the message “waiting for an available server” for about 2 minutes before loading the game.

2 - The second is that TeleportToPrivateServer does not teleport players; in this game, players sit in a few chairs and every 30 seconds, all seated players are teleported to a reserved server of a place. This simply doesn’t happen, and after up to 5 minutes of waiting, it either shows a 702 error saying that the place doesn’t exist, or a 772 error and teleports only some players. There are various chairs groups to different places; all tested, none of them teleports.
There is no error in the command window.

My team put a lot of time and effort on this, and the game was working perfectly fine with up to 20 people before releasing it. Please any help is highly appreciated.

2 Likes

sure!
i will explain it a little:
“tama” refers to the size of a surface gui; its a bar to say players when the next teleport will occur. At the end of the script (on the main tram part), it waits the bar to fill up and then calls the function to teleport.

About the teleport function, first get all the occupants of the chair group, add them to a temporal table, and then if the table have at least 1 element, calls the teleport service, reserve a server, and teleports them.

---------------behaviour-----------------
local tama = 1

function Transporta()
	local jugadoresSentados = {}
	for i, v in pairs(script.Parent.Asientos:GetChildren()) do
		if v.Occupant ~= nil then
			local plr= game.Players:GetPlayerFromCharacter(v.Occupant.Parent)
			table.insert(jugadoresSentados, plr)
		end
	end
	
	if #jugadoresSentados> 0 then
		script.Parent.Barrera.Script.Disabled = false
		local TeleportService = game:GetService("TeleportService")
		local ID = script.Parent.ID.Value
		local Code = TeleportService:ReserveServer(ID)
		TeleportService:TeleportToPrivateServer(ID,Code,jugadoresSentados)
	end	
end

---------------main tram-----------------
while true do
	tama = tama - 0.05
	script.Parent.boardInfo.SurfaceGui.Frame.TextLabel.Size = UDim2.new(tama, 0, 1, 0)
	if tama < 0.05 then
		tama = 1
		Transporta()
	end
	wait(1)
end

Is your ID Value the Place ID? If not then this is your solution. As you need to give for the :ReserveServer the PlaceId by game.PlaceId. Same for the teleport you have to give the PlaceId.

Yes the id.value its the place id.
The game isnt loading again -_-

Again, the primary issue of the service is the API latencies. As previously mentioned below here:

2 Likes

Thank you Operatik, muito obrigado.
The issue that prevent people from even joining the game can be related to that?

Yeah, sometimes it does fail the teleportation or that the reserved server “closed itself” due to no players. Personally, I experienced this in games with such occurrence.