Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why did teleportation to a secondary place of game fail?

Asked by 4 years ago

I set up a system where when you walk into a box it is supposed to teleport you to a secondary place of the game, but when testing it just errored as shown below. I have attached pictures of the error from my developer account, and on an alt. If you would like to test this the game link is this.

Developer Account Error

Alt Account Error

This is the teleportation code:

local TpService = game:GetService("TeleportService")
local Players = game:GetService("Players"):GetPlayers()
local TeamService = game:GetService("Teams")
local TeleportService = game:GetService("TeleportService")

local timeUntilTp = game.ServerStorage.TimeUntilTeleport

local Gui = game.Workspace.HoldingChamber.HoldingChamberSpawn.BillboardGui.TextLabel

while wait(1) do
    if #TeamService.Waiting:GetPlayers() >= 1 then
        timeUntilTp.Value = 30

        wait()

        for i = timeUntilTp.Value, 1, -1 do
            timeUntilTp.Value = timeUntilTp.Value - 1
            Gui.Text = 'Teleporting in '..tostring(timeUntilTp.Value)..' seconds.'
            wait(1)
        end

        Gui.Text = 'Teleporting soon!'

        if #TeamService.Waiting:GetPlayers() >= 1 then
            local rs = TeleportService:ReserveServer(5890026222)
            local Players = game:GetService("Players"):GetPlayers()
            local playersToTp = TeamService.Waiting:GetPlayers()

            TeleportService:TeleportToPrivateServer(game.PlaceId,rs,playersToTp)
        end
    end
end

Thank you! Any help is greatly appreciated.

1 answer

Log in to vote
0
Answered by 4 years ago

You're not teleporting to the other game. Your code is trying to take the player to the same game he/she is in. You should get the secondary place's ID, and use it

TeleportService:TeleportToPrivateServer(5890026222, rs, playersToTP)
0
The original place's id (the place with the teleporter in it) is 5889759201 while the script is teleporting to 5890026222 (the secondary place id). lincol92008 46 — 4y
0
Sorry, I didn't completely understand what you were saying earlier, but with some more debugging I figured out what was wrong and understood what you were saying. Thank you for the help! lincol92008 46 — 4y
Ad

Answer this question