TeleportToPrivateServer not working properly!

What I want to achieve is a bus queue system, where after 30 seconds, you teleport to the actual place (Not start place)

The issue is you are not being teleported. Code:

local TS = game:GetService("TeleportService")
    local Players = game:GetService("Players")
    
    local code = TS:ReserveServer(3387119488)
    
    local function moveto_mainGame(plr)
        if workspace.Players.InBus1:FindFirstChild(plr.Name) then
            TS:TeleportToPrivateServer(3387119488,code,{plr})
            workspace.Players.InBus1[plr.Name]:Destroy()
        end
    end
    
    for i,v in pairs(Players:GetPlayers()) do
        moveto_mainGame(v)
    end
lua

I have tried going on wiki, but no solutions have came to mind.

1 Like

You first created a reserved server with the placeid id: 3387119488

Then tried to teleport to it using the current place id
TS:TeleportToPrivateServer(game.PlaceId,code,{plr})

You should replace game.PlaceID with the placeid of the other place.

It gives me Http 400 Error. I done this:
TS:TeleportToPrivateServer(3387119488,code,{plr})

Are you in studio? These stuff dont work in studio.

It wont work because as you can see

local code = DS:GetAsync("ReservedServer")
if type(code) ~= "string" then
code = TS:ReserveServer(3387119488)
DS:SetAsync("ReservedServer",code)
end

Here, the code would appear as a string, so the code variabe would become nil.

1 Like

oh Im an idiot, try printing the code, what would it return?

In-game, it just gives me a Teleport Error

I updated the code to make it more sense, but still gives me the same error:

local TS = game:GetService("TeleportService")
    local Players = game:GetService("Players")
    
    local code = TS:ReserveServer(3387119488)
    
    local function moveto_mainGame(plr)
        if workspace.Players.InBus1:FindFirstChild(plr.Name) then
            TS:TeleportToPrivateServer(3387119488,code,{plr})
            workspace.Players.InBus1[plr.Name]:Destroy()
        end
    end
    
    for i,v in pairs(Players:GetPlayers()) do
        moveto_mainGame(v)
    end
lua

Are both places in the same game?

Yes, my sir man. TooShortForMe.

Nothing printed, the error happend at this line, and the script crashed at this line:

local code = TS:ReserveServer(3387119488)
lua

Is this a local or a server script?

It is a server script. My sir.

Are you sure you restarted the server correctly after editing everything?? Try again.

To be honest that’s so weird, that looks like a roblox issue.

Yes, we did. Also, the 30 character limit is annoying.

Yea, for my game it works well for some issues, i can gurantee most games has the same issue.

Randomly started working, odd.

1 Like

Oof. Nice, roblox weird server issues.

Hello,
I am also looking for a TeleportToPrivateServer system. I want to know what changes did you done for it works please ? Thanks for answer :smiley:
For my script, there is a value who turn true when a part is touch and every X seconds it teleport the players who had the value == true.
Here the script:

script.Parent.Touched:Connect(function(hit)
local TS = game:GetService(“TeleportService”)
local Players = game:GetService(“Players”)
local code = TS:ReserveServer(3447839380) – Returns a code
local players = game.Players:GetChildren()
local function moveto_mainGame(plr)
if plr:FindFirstChild(“Settings”).Playing.Value == true then
TS:TeleportToPrivateServer(3447839380,code,{plr})
end
end
for i,v in pairs(Players:GetPlayers()) do
moveto_mainGame(v)
end
end)

It worked, just use the script I listed in the post :slight_smile: