Skip to Content
Kinemium

GuiButton

Base class for clickable GUI elements.

GuiButton adds button behavior to GuiObject. It tracks hover, press, and selection state and exposes the click events shared by TextButton and ImageButton.

Getting started

local button = Instance.new("TextButton")

button.Activated:Connect(function()
    print("clicked")
end)

button.MouseButton2Click:Connect(function()
    print("right clicked")
end)

Properties

PropertyTypeAccessDefaultDescription
AutoButtonColorbooleanRead/writetrueTint the button on hover and press.
ModalbooleanRead/writefalseBlock input to elements behind it.
SelectedbooleanRead/writefalseWhether the button is selected.

Events

EventArgumentsDescription
ActivatednonePrimary click completed.
SecondaryActivatednoneSecondary click completed.
MouseButton1ClicknoneLeft click completed.
MouseButton1DownnoneLeft button pressed.
MouseButton1UpnoneLeft button released.
MouseButton2ClicknoneRight click completed.
MouseButton2DownnoneRight button pressed.
MouseButton2UpnoneRight button released.

Notes

  • This is the base class; it has no text or image content of its own. Use TextButton or ImageButton for visuals.
  • Activated also fires for touch input.
  • Automatic button color is applied by the concrete button classes.
  • Inherits all GuiObject members.

See also

  • TextButton and ImageButton.
  • GuiObject for layout and input properties.

On this page