So i made a GUI that i wanted it to teleport the player whenever its pressed so here is the Script:
player = game.Players.LocalPlayer script.Parent.MouseButton1Click():connect(function() game:GetService("TeleportService"):TeleportToSpawnByName(303813754, "Neutral Spawn", player) end)
Thanks in advance to whoever helps me
EDIT() I forgot to write what i got in the output ;-;
21:24:48.631 - Players.Player.PlayerGui.ScreenGui.Frame.TextButton.LocalScript:3: attempt to call field 'MouseButton1Click' (a userdata value) 21:24:48.633 - Stack Begin 21:24:48.635 - Script 'Players.Player.PlayerGui.ScreenGui.Frame.TextButton.LocalScript', Line 3 21:24:48.636 - Stack End
Remove the parentheses before MouseButton1Click and you should be good to go! ^_^