We use cookies on this site to enhance your user experience
Collapse Sidebar


The MouseButton1Click event fires when the user’s Mouse fully right 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 GuiButton/MouseButton2Down and MouseButton2Up. These events are similar, but will fire whenever the user pressed their left mouse down or up, respectively.

This event is similar to GuiButton/MouseButton1Click, which behaves identically except that it is connected to the user’s left mouse button.

Note that this event will only fire for GUI buttons, including TextButton|TextButtons and ImageButton|ImageButton. It will not fire for other GuiObject|GuiObjects.

Code Samples

Handling User Clicks on a GUI Button

The code sample below demonstrates how to use the GuiButton/MouseButton1Click and GuiButton/MouseButton2Click events to handle user left and right mouse button input on a GuiButton.

For the example to work expected, the LocalScript containing the code should be a child of the GUI button.

function leftClick()
	print("Left mouse click")

function rightClick()
	print("Right mouse click")