I have a surface gui button in workspace with a server script inside detecting if someone clicks it, how might I get the player from this? this is 100% pivotal for the thing im trying to make.
please send screenshots of
- what result you want
- the script(s) used for it
Well GUIS are meant to be used locally, so using a server script for them isn’t ideal.
There is no great way to be able to tell who pressed the button… however what you could consider doing is adding a local script into StarterPlayerScripts
, which send a remote event every time the button is pressed locally. The remote event should send the player that pressed it, and then you can use os.clock() to see who pressed it first, if that’s important to the functionality.
I found a solution myself. Thank you for helping though. The main problem was an actual local script wasn’t working or detecting the clicks, so I made a server script, and ran it on the client, and that worked. And then I just passed the player variable around and it worked.