Teleport Button

Why won’t this teleport script work inside a BillboardGUI? It’s in a local script inside a button inside a billboard GUI.

	game:GetService('TeleportService'):Teleport(6136103884, game.Players.LocalPlayer)
end)

I’ve never really touched TeleportService before so I’m not really sure how it works.

1 Like

Apparently, Teleport has to be triggered inside the Server script.

What do you mean? Could you give an example.

LocalScripts only run in certain places. See LocalScript.
As someone else has also pointed out, the server (a Script) must teleport the player. Try using a RemoteEvent.

1 Like

Understanding how a local script and a server script work is KEY to understanding how Roblox works.
Without this understanding, you will have many difficulties.
Start studying and testing from these articles:

https://developer.roblox.com/en-us/articles/Roblox-Client-Server-Model
https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
https://developer.roblox.com/en-us/articles/game-testing

Assuming that’s a local script, try

game:GetService('TeleportService'):Teleport(ID)

Just a note, TeleportService would not run if in Studio. If this does not work, try running the code in a server script.

Ight, before we begin, I will send you an article on how TeleportService works;

ServerScript:

local RemoteEvent = game.ReplicatedStorage:WaitForChild("Teleporter")

RemoteEvent.OnServerEvent:Connect(function(Player)
    local TeleportService = game:GetService("TeleportService")
    TeleportService:TeleportAsync(Player, 6136103884)
end)

LocalScript:

local RemoteEvent = Instance.new("RemoteEvent", game.ReplicatedStorage)
RemoteEvent.Name = "Teleporter"

script.Parent.MouseButton1Down:Connect(function()
    RemoteEvent:FireServer()
end)

That should work, let me know otherwise!

Does it work correctly though?

No, no teleporting happens in-game, not just in studio

Studio doesn’t have access to TeleportService. Anyway, if my script did help, if you would be so kind to solution and heart my reply, that would be amazing! Anyway, do make sure to have a great day/night! :slightly_smiling_face:

I published it, and unfortunately it doesn’t work in-game either

If it’s a third-party game, make sure to enable third-party teleports in Studio >> Game Settings >> Secuity (I believe) >> 3rd Party Teleports.