Click to teleport

I added a server script into a part that was containing a ClickDetector when I click the part it won’t teleport me to the game.

Script:
local Part = script.Parent

local CD = Part.ClickDetector

local GameId = 10637544221

CD.MouseClick:connect(function(Player)

game:GetService(‘TeleportService’):Teleport(GameId, Player)

end)

1 Like

make sure the game is published and you have Third Party Teleports Enabled.
you could also use TeleportAsync

game:GetService("TeleportService"):TeleportAsync(GameId,{Player})