The MouseButton1Click event fires when the user’s
Mouse fully left clicks the GUI button.
By clicking, the mouse has to be in bounds of the button and has to be pressed down and up again before this event fires. If the mouse leaves the bounds of the button and is released, the even will not fire. If you would like to avoid this limitation, you can use
MouseButton1Up. These events are similar, but will fire whenever the user pressed their left mouse down or up, respectively.
This event is similar to
GuiButton/MouseButton2Click, which behaves identically except that it is connected to the user’s right mouse button.
Note that this event will only fire for GUI buttons, including
ImageButton|ImageButton. It will not fire for other
Handling User Clicks on a GUI Button
The code sample below demonstrates how to use the
GuiButton/MouseButton2Click events to handle user left and right mouse button input on a
For the example to work expected, the
LocalScript containing the code should be a child of the GUI button.