How do I check when a button inside of a GUI is clicked? The scripts from ROBLOX's website don't work for some reason.
✓ ANSWER ACCEPTED
How do I check when a gui's button is clicked?
1 answer
✓ Accepted answer
You need a TextButton or an ImageButton to register a MouseButton1Click or MouseButton1Down event. Put a script in your TextButton/ImageButton and paste the following code.:
script.Parent.MouseButton1Click:Connect(function() -- Attach a function to your MouseButton1Click RBXScriptSignal
-- Your code here.
end)
4 comments
0
Tiny correction, make sure it's a LocalScript because a script wouldn't detect it as well as GUIs are only on the client.
0
true
0
true
0
Thanks.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Post the Script please
Um... I don’t have a script for the GUI related to clicking a button yet...
I do have two text buttons inside of a frame and a text label though.