Game teleporters not working

Hello, developer forum!
I have recently decided to create a new game called “Roblox game teleporter” in this game you can select a game a teleport there. However, I have coded out a teleporter and my teleporters don’t seem to work.

Below is the teleport part script:

local TeleportService = game:GetService(“TeleportService”)

local Place = 1962086868

function onTouched(hit)

local player = game.Players:GetPlayerFromCharacter(hit.Parent)

if player then

TeleportService:Teleport(Place, player)

end

end

script.Parent.Touched:Connect(onTouched)

Below is the UI button script:

local TeleportService = game:GetService(“TeleportService”)

local Place = 5439121125

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()

TeleportService:Teleport(Place,player)

end)

Overall I am wondering if I made an error in my scripting or if you just cant teleport to large games. Thank you so much for reading!

-Jackoob_YT

1 Like

Your code doesn’t have any issues. So I’m assuming it’s because of this.

2 Likes

Have you tested this in a public server? This won’t work in studio.

1 Like

Hi! I have tested this in a public server before and it still doesn’t seem to work.

Have you turned on third party teleports in game security*?
* Home > Game Settings > Security > Allow Third Party Teleports

1 Like

Is the code local or serversided? There is local code below

If it’s either, it won’t work. If it’s local, the teleport won’t run because according to the devhub “When teleporting from the client, as only the Players.LocalPlayer can be teleported, no player argument is required”, if it’s server, the player will error it out.

2 Likes

Thank you all so much for your help!

1 Like