Hello, I'm trying to code a Player Teleportation script for an OnClicked Gui to teleport to my game. The code is below.
function OnClicked()
script.Disabled = true
local player = script.Parent.Parent.Parent.Parent
if player then
game:GetService("TeleportService"):Teleport(361416851, player)
end
end
script.Parent.MouseButton1Click:connect(OnClicked)
Why does this not work in a game? If someone can help me, that'd be great!

1 comment
Here is the game if you wanted to see it. https://www.roblox.com/games/723448353/test