PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

AutoButtonColor

GuiButton

bool

The AutoButtonColor determines whether the button automatically changes color when the user’s Mouse hovers over or clicks on it.

If true, the button will automatically change color when the mouse hovers over or clicks on it. If false, the button will not change.

If you would like to customize how a button changes when the user’s mouse hovers over or clicks on it, consider using an ImageButton GUI and changing the element’s ImageButton/HoverImage and ImageButton.PressedImage.

Please note that this property will not have an effect on an ImageButton if it’s ImageButton/Image property is set to an image and is not null. Additionally, the property will not affect an ImageButton element on mouse hover when its ImageButton/HoverImage is not null nor on mouse click if ImageButton/PressedImage is not null.


Code Samples


Changing a GUI Button's Color on Hover and Click

The code below enables a button’s GuiButton/AutoButtonColor as long as it it not a ImageButton with ImageButton/HoverImage and ImageButton/PressedImage properties set to images.

In order for the code to work as expected, it must be placed in a LocalScript that is a child of the button.