Newbie scripter here, thought I'd get that out of the way. Anyway, I have a SurfaceGUI on a part with a script inside of an ImageButton that says:
local TeleportService = game:GetService("TeleportService")
local id = 183840542
function onClicked(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
TeleportService:Teleport(id, player)
end
end
script.Parent.MouseButton1Click:connect(onClicked)
I don't really know why this isn't working. I was able to use a variation of this script using the Touched event instead of MouseButton1Click, but that was on a regular part and not a SurfaceGUI. Can anyone give me advice?

2 comments
while this does make sense, i thought SurfaceGUIs should use server scripts since they're inside the workspace.
They use user input (mouse) so they need to be local in some cases, https://forum.scriptinghelpers.org/topic/19/interactive-surfaceguis