Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why did teleportation to a secondary place of game fail?

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

✓ Accepted answer

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)

2 comments

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).

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.