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

How to properly teleport? No errors but it does not work.

Hello ScriptingHelpers! I have a problem with teleport service, where I finally get no errors, but the teleportation never occurs. Here's the code. (This is in a server script, by the way.)

local ts = game:GetService("TeleportService")

local btn = script.Parent

local gameID = 6266940721

game.Players.PlayerAdded:Connect(function(player)
	plr = player
end)

local function teleporter(gameID, plr)
	local plr = game.Players:FindFirstChild(plr)
	print("Teleporting to game")
	ts:Teleport(plr, gameID)
end

btn.Activated:Connect(function()
	teleporter(gameID, plr)
end)

All help is appreciated!

2 comments

0

You swapped the parameters of ts:Teleport(). The placeID comes first, then the player. Also it won't work on studio

0

You swapped the parameters of ts:Teleport(). The placeID comes first, then the player. Also it won't work on studio

1 answer

Maybe you don't have it enabled on the studio settings. Try publishing your game to get access to those settings then navigate to, game settings>Security>Allow third party teleports.Enable it if its disable and test the script again. Hope this helps.

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