How to check which player clicked on a surface gui text button?
For example: We have a surface gui text button whereas if we click, then the .MouseButton1Click function will be fired (which can be done by enabling BillboardGui.AlwaysOnTop)
And here is my question, how do you check which player has fired the .MouseButton1Click function?
If you need it specifically on server:
What you could do is hook up a ClickDetector and use the MouseClick event of that instance on the server which passes the Player as the first argument.
Otherwise, if it is on client, you could simply reference the LocalPlayer inside the MouseButton1Click event.
yes, surface gui buttons are still held on the client
aside from visuals. (I have been messing with this issue myself, and best i have found is to have a surface gui in your starter gui and just set adornee to the part you want)
Oh you’re looking for buttons, well, then I suggest you fire a remote to the server when they click it on the client, signaling that they clicked it.
That’s just bad practice. You shouldn’t be having “what-ifs”, you need to know what your code does, and if it requires you to constantly re-instatiate your UI then you need to think twice about the path you’re taking.