Teleport Player Gui

  1. What do you want to achieve?
    I want to make a gui that when a player clicks it, it takes them to a different place

  2. What is the issue?
    Whenever I press on the button, it show an error message saying “Attempted to teleport to a place that is restricted”
    image

  3. What solutions have you tried so far?
    I’ve tried changing the code multiple times.

-- Here's the code that im currently using
local TeleportService = game:GetService("TeleportService")
Plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
	TeleportService:Teleport(12213643771, Plr)
end)

Keep in mind that I have made the place public and also enabled Third party teleports.
Ty so much for you help!

1 Like

Make sure that you’re playing this outside of Studio, and I’d consider removing the Plr argument in your Teleport function as by default:

-- Here's the code that im currently using
local TeleportService = game:GetService("TeleportService")
local Plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
	TeleportService:Teleport(12213643771)
end)
2 Likes

I removed Plr and tested it outside of studio, however the same issue has occurred.

1 Like

Strange, can you confirm that the Place ID you’re attempting to teleport through is properly valid, and is not a sub-place from a whole different game outside of where you’re teleporting from?

And this should be a LocalScript, so I’d presume everything would work fine

If that doesn’t work, I’d retake a look into the Teleporting between Places guide along with possibly restarting Studio

2 Likes