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

Why does my Place Teleporter button not work?

I have a LocalScript in a TextButton which is inside a SurfaceGUI, which when it is clicked, it teleports you to another place, but instead, all it does is say in the Output "Invalid Player to teleport". I would need help as I tried with a Server script and a Local one but it still doesn't work. Thanks!

local TeleportService = game:GetService("TeleportService")

function leftClick()
    TeleportService:Teleport("4769406515")
end

script.Parent.MouseButton1Click:Connect(leftClick)

1 answer

:Teleport() requires a Player Object argument to understand what Client it is supposed to transfer. The PlaceId is also expected as an Int 64, so please define the PlaceId as a numerical serial.

local TeleportService = game:GetService("TeleportService")
local Player = game:GetService("Players").LocalPlayer

function leftClick()
    TeleportService:Teleport(4769406515, Player)
end

script.Parent.MouseButton1Click:Connect(leftClick)

Though, this isn't necessarily required as :Teleport() will automatically transfer the local Player Object if called within the Client. Just remember this for future reference

4 comments

0

It still doesn't work, but shows nothing in the output, neither in-game or in studio.

0

"In some circumstances a teleport may fail. This can be due to the developer configuring the teleport incorrectly or issues with ROBLOX servers."

0

Read up on the Teleport function I have hyperlinked to debug ^^

0

you cant teleport to a game in studio u have to do it in roblox

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