I’m working on a server hop where it throws you into a singleplayer server, however, it keeps returning me “Unable to teleport to a restricted place”, the ID is right, I just dont know what I’m doing wrong. The place is public, and is an instance of the actual game you’re teleporting from
Code snippet:
local tpserv = game:GetService("TeleportService")
local Server = tpserv:ReserveServer(id)
task.spawn(function()
for i=1,20 do
if player == nil then
break
end
tpserv:TeleportToPrivateServer(id,tpserv,{player})
task.wait(0.8)
end
end)
I don’t know what I’m doing wrong, because this is my first time I’m using Reserving. The game is not private.
Yeah, also why are you looping the function here? It seems a bit unnecessary to keep calling the function over and over again, couldn’t you just apply some sanity checks first?
In case you’re still struggling with the issue, there’s 3 mandatory parameters to have within your script
The Place ID (Not Universe/Game ID!)
The Code that returns back the ReserveServer function
An array/table of Players
And also make sure the script that you’re using is a Script (Not a LocalScript, cause those are 2 different things)
I was originally repeating it because reserve server takes forever, and before I made it loop in the first place, it would error most of the time saying that it took too long and the game server has closed or something along the lines.
You should probably look more into that then if that’s the case, consider possibly waiting until the Player has fully loaded in to properly call the function at that point of time so that it doesn’t error