I have tried tons of scripts but none will work for my SurfaceGUI on a simple part. I click it and nothing happens, nothing in the output too. I want it to teleport to a place in my game universe. Here is the code I've tried recently.
function onClicked(playerWhoClicked) local player = game.Players[playerWhoClicked] if player then game:GetService("TeleportService"):Teleport(512970811, player) end end
script.Parent.Button1Down:connect(function(playerWhoClicked) local player = game.Players[playerWhoClicked] if player then game.GetService("TeleportService"):Teleport(512970811,player) end end)
This script assumes that the script is in the button