I have a GUI button in my place that pops up after I touch a certain part. For the part, I have both a local script and a server script that detects when/which player touched, fires a remote event, and then puts the GUI in their PlayerGUI. However, with GUI buttons, I can't use the touched property. Does anyone know of a way that I can set up an event listener for when I click a GUI button? Thanks in advance.
How do you set up a FE GUI button event?
1 answer
It's bit tough to understand your problem here, but I will just go step by step through the situation.
So, from what I understand you have a GUI in a part, that should get copied to player once the part is touched. In this case, you have two choices, have a regular script inside the part, that detects when someone touches it or have a local script in LocalPlayerScripts/LocalCharacterScripts that does the same.
The local script that handles GUI should be inside the GUI itself, and would run automatically as you copy it to PlayerGui. Also, you seem to fire a remote event. It would probably be a good idea to do it after you copy the GUI to PlayerGui, and maybe with small delay, so that the local script can load properly and catch that event.
And for GUI buttons you don't have a touched event. Instead you have several mouse buttons. You could use either button.MouseButton1Down or button.MouseButton1Click. For more events, make sure to check out the wiki: http://wiki.roblox.com/index.php?title=API:Class/TextButton
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
So you want a server script to run when a gui gets clicked?
@theCJarmy7 Yeah