Skip to content

GuiButton

Supported Class GUI NotBrowsable NotCreatable

An abstract class for interactive 2D user interface elements.

11 Nova members · 4 modern Roblox members not implemented yet

Description

GuiButton is an abstract class that inherits from GuiObject. It is the base class for the interactive, clickable ImageButton and TextButton objects. This class also defines several properties for interactive behavior, namely AutoButtonColor and Modal.

The most important event of a GuiButton is Activated, a multi-platform event that fires when the button is activated. When using a mouse, this means clicking the button and releasing with the cursor still over the UI object. For touch, the same applies but with a touch instead of button press. Finally, for gamepads, Activated fires if a GuiButton is selected when the A button is pressed and released. In short, this event is very useful for multi-platform user interface programming as it provides a nice general interface for a single user input.

Inheritance

Object → Instance → GuiBase → GuiBase2d → GuiObject → GuiButton

Nova inheritance: Instance → GuiBase → GuiBase2d → GuiObject → GuiButton

Known subclasses: ImageButton, TextButton

Properties

AutoButtonColor Supported Property Determines whether the button automatically changes color when the mouse hovers over or clicks on it.
AutoButtonColor: bool

Determines whether the button automatically changes color when the mouse hovers over or clicks on it.

This property 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 and changing the element's HoverImage and PressedImage.

Please note that this property will not have an effect on an ImageButton if its Image property is set to an image. Additionally, this property will not affect an ImageButton on mouse hover when its HoverImage is not nil, nor on mouse click if its PressedImage is not nil.

Roblox documentation

Selected Supported Property Nova: still functional Selected state for gamepad/GUI navigation.
Selected: bool

Selected state for gamepad/GUI navigation.

Nova's GuiButton selection logic reads and writes this property as part of its selected-object handling.

Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

Style Supported Property Sets the style of the GuiButton based on a list of pre-determined styles.
Style: ButtonStyle

Sets the style of the GuiButton based on a list of pre-determined styles.

Sets the button's overall appearance from a fixed set of ButtonStyle presets. The default value is Custom, which applies no built-in styling and lets you control the button's appearance entirely through properties such as BackgroundColor3 and, for an ImageButton, its images.

A legacy method of applying a fixed set of Roblox-themed button styles. The remaining presets (RobloxButton, RobloxButtonDefault, RobloxRoundButton, RobloxRoundDefaultButton, and RobloxRoundDropdownButton) render Roblox-themed button art. New interfaces should keep Custom and style the button directly. This property defaults to ButtonStyle.Custom.

Roblox documentation

Methods

SetVerb Supported Function
GuiButton:SetVerb(string verb)

No description available.

Security: RobloxScriptSecurity

Roblox documentation

Events

MouseButton1Click Supported Event Fires when the user's mouse fully left clicks the GuiButton.
MouseButton1Click()

This event fires when the user's mouse fully left clicks the GuiButton.

In regards to clicking, the mouse must be in bounds of the GuiButton and the mouse button must be pressed down and up again before this event fires. If the mouse leaves the bounds of the GuiButton and is released, the event will not fire. If you would like to avoid this limitation, you can use MouseButton1Down and MouseButton1Up; these events are similar but will fire whenever the user presses their left mouse button down or up, respectively.

Roblox documentation

MouseButton1Down Supported Event Fires when the user presses their left mouse button down on the GuiButton.
MouseButton1Down(int x, int y)

This event fires when the user presses their left mouse button down on the GuiButton.

For an event requiring the user to press and release their left mouse on a GuiButton in order for the event to fire, consider using MouseButton1Click.

Roblox reference signature
MouseButton1Down(x: int, y: int)

Roblox documentation

MouseButton1Up Supported Event Fires when the user releases their left mouse button off of the GuiButton.
MouseButton1Up(int x, int y)

This event fires when the user releases their left mouse button off of the GuiButton.

For an event requiring the user to press and release their left mouse on a GuiButton in order for the event to fire, consider using MouseButton1Click.

Roblox reference signature
MouseButton1Up(x: int, y: int)

Roblox documentation

MouseButton2Click Supported Event Fires when the user's mouse fully right clicks the GuiButton.
MouseButton2Click()

This event fires when the user's mouse fully right clicks the GuiButton.

In regards to clicking, the mouse must be in bounds of the GuiButton and the mouse button must be pressed down and up again before this event fires. If the mouse leaves the bounds of the GuiButton and is released, the event will not fire. If you would like to avoid this limitation, you can use MouseButton2Down and MouseButton2Up; these events are similar but will fire whenever the user presses their right mouse button down or up, respectively.

Roblox documentation

MouseButton2Down Supported Event Fires when the user presses their right mouse button down on the GuiButton.
MouseButton2Down(int x, int y)

This event fires when the user presses their right mouse button down on the GuiButton.

For an event requiring the user to press and release their right mouse on a GuiButton in order for the event to fire, consider using MouseButton2Click.

Roblox reference signature
MouseButton2Down(x: int, y: int)

Roblox documentation

MouseButton2Up Supported Event Fires when the user releases their right mouse button off of the GuiButton.
MouseButton2Up(int x, int y)

This event fires when the user releases their right mouse button off of the GuiButton.

For an event requiring the user to press and release their right mouse on a GuiButton in order for the event to fire, consider using MouseButton2Click.

Roblox reference signature
MouseButton2Up(x: int, y: int)

Roblox documentation

Inherited members

Inherited from GuiObject: 45 properties, 39 methods, 25 events. They are documented on the base class page.

4 modern Roblox member(s) are not implemented yet — expand to inspect

Members declared by Roblox's GuiButton class (or by a missing base class) that Nova does not expose. Use this list to scope a migration; the compatibility guide has the recommended workaround.

Properties

Member Signature Status Notes Flags
HoverHapticEffect HoverHapticEffect: HapticEffect Not yet A HapticEffect instance that will play when the GuiButton is being hovered. —
PressHapticEffect PressHapticEffect: HapticEffect Not yet A HapticEffect instance that will play when the GuiButton is being pressed. —

Events

Member Signature Status Notes Flags
Activated Activated(inputObject: InputObject, clickCount: int) Not yet Fires when the button is activated. —
SecondaryActivated SecondaryActivated(inputObject: InputObject) Not yet Fires when the button's "secondary" input is activated. —

Roblox reference: GuiButton

Generated from Nova's API dump and Roblox creator-docs. Nova-only members come from the engine's reflection metadata.