How to Get player from SurfaceGui

How do I get the player who is clicking a mouse button on a surface gui? I haven’t done any coding with surface gui before so I don’t really know?

1 Like

The correct way is to set up a client-side LocalScript which listens for the Activated event.

Scripting SurfaceGui’s is just like scripting Gui parented to PlayerGui. A practice I usually use is to create the SurfaceGui’s locally and then parent them to the workspace, so that they are always controlled by the client.
If you want to record input for server-wide surfacegui’s, an easy way to do this is by utilizing CollectionService to tag and find all buttons/elements you want to listen to.