Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I check when a gui's button is clicked?

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.

3 comments

0

Post the Script please

0

Um... I don’t have a script for the GUI related to clicking a button yet...

0

I do have two text buttons inside of a frame and a text label though.

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.