Open Asterune
ImageButton

ImageButton

An interactive GUI button rendered with an image.

Creatable
Instance.new("ImageButton")
Inherits
GuiButtonGuiObjectGuiBase2dGuiBaseInstance
Replication
Standard

Behavior

ImageButton displays an image and receives pointer, touch, or gamepad activation. It also exposes the text-style fields provided by the shared GUI label surface.

Summary

Members65
Properties47
Methods3
Events15
  • Activated: RBXScriptSignalparallel read

    Fires when the button is activated by an accepted pointer, touch, or gamepad input.

  • DragBegin: RBXScriptSignalparallel readdeprecated

    Fires when pointer dragging of the element begins.

  • DragStopped: RBXScriptSignalparallel readdeprecated

    Fires when pointer dragging of the element ends.

  • InputBegan: RBXScriptSignalparallel read

    Fires when input begins over or is dispatched to this interface element.

  • InputChanged: RBXScriptSignalparallel read

    Fires when input dispatched to this element changes.

  • InputEnded: RBXScriptSignalparallel read

    Fires when input dispatched to this element ends.

  • MouseWheelBackward: RBXScriptSignalparallel read

    Fires when the mouse wheel scrolls backward over this element.

  • MouseWheelForward: RBXScriptSignalparallel read

    Fires when the mouse wheel scrolls forward over this element.

  • PointerEntered: RBXScriptSignalparallel read

    Fires when a pointer moves onto the button.

  • PointerExited: RBXScriptSignalparallel read

    Fires when a pointer moves off the button.

  • PointerMoved: RBXScriptSignalparallel read

    Fires when the pointer moves across the button.

  • Pressed: RBXScriptSignalparallel read

    Fires when the button enters its pressed state.

  • Released: RBXScriptSignalparallel read

    Fires when the button leaves its pressed state.

  • SelectionGained: RBXScriptSignalparallel read

    Fires when interface navigation selects this element.

  • SelectionLost: RBXScriptSignalparallel read

    Fires when this element loses interface selection.

Properties

AbsolutePosition

ImageButton.AbsolutePosition: Vector2 = Vector2.new(0, 0)

The resolved top-left position of this interface element in pixels.

AbsoluteRotation

ImageButton.AbsoluteRotation: number = 0

The resolved rotation of this interface element in degrees, including ancestor rotation.

AbsoluteSize

ImageButton.AbsoluteSize: Vector2 = Vector2.new(0, 0)

The resolved width and height of this interface element in pixels.

Active

ImageButton.Active: boolean = true

Whether this interface accepts and consumes input.

AnchorPoint

ImageButton.AnchorPoint: Vector2 = Vector2.new(0, 0)

The normalized point within the element used as the origin for Position. (0, 0) is the top-left corner; (0.5, 0.5) is the center.

AutoButtonColor

ImageButton.AutoButtonColor: boolean = true

Whether the button automatically changes color during pointer interaction.

AutomaticSize

ImageButton.AutomaticSize: Enum.AutomaticSize = Enum.AutomaticSize.None

The dimensions that resize to fit the element's content.

BackgroundColor3

ImageButton.BackgroundColor3: Color3 = Color3.new(0.6392157, 0.63529414, 0.64705884)

The color used to fill the element's background.

BackgroundTransparency

ImageButton.BackgroundTransparency: number = 0

The background transparency, from 0 for opaque to 1 for invisible.

BorderColor3

ImageButton.BorderColor3: Color3 = Color3.new(0.105882354, 0.16470589, 0.20784314)

The color of the element's border.

BorderMode

ImageButton.BorderMode: Enum.BorderMode = Enum.BorderMode.Outline

Whether the border is drawn outside, across, or inside the element's bounds.

BorderSizePixel

ImageButton.BorderSizePixel: number = 1

The border thickness in pixels.

ClipsDescendants

ImageButton.ClipsDescendants: boolean = false

Whether descendant rendering is clipped to this element's bounds.

CornerRadius

ImageButton.CornerRadius: number = 0

The corner radius used for the element's rounded background.

Corners

ImageButton.Corners: { number } = {}

The individual corner radii used for the element's rounded background.

Draggable

ImageButton.Draggable: boolean = false

Whether pointer dragging can move the element.

Grow

ImageButton.Grow: number = 0

The share of remaining main-axis space assigned to this child in flow layout.

GuiState

ImageButton.GuiState: Enum.GuiState = Enum.GuiState.Idle

The element's current idle, hover, pressed, or non-interactable state.

Image

ImageButton.Image: Content = ""

The content identifier of the displayed image.

ImageColor3

ImageButton.ImageColor3: Color3 = Color3.new(1, 1, 1)

The tint multiplied into the image color.

ImageRectOffset

ImageButton.ImageRectOffset: Vector2 = Vector2.new(0, 0)

The top-left pixel offset of the image region to display.

ImageRectSize

ImageButton.ImageRectSize: Vector2 = Vector2.new(0, 0)

The size in pixels of the image region to display.

ImageTransparency

ImageButton.ImageTransparency: number = 0

The image transparency, from 0 for opaque to 1 for invisible.

InputSink

ImageButton.InputSink: Enum.InputSink = Enum.InputSink.None

Which input events this element consumes before they reach elements behind it.

Interactable

ImageButton.Interactable: boolean = true

Whether the element accepts interaction.

Layout

ImageButton.Layout: Enum.Layout = Enum.Layout.Flow

Whether children use flow layout or their explicit positions.

LayoutOrder

ImageButton.LayoutOrder: number = 0

The numeric order of this element when a parent layout sorts by layout order.

Modal

ImageButton.Modal: boolean = false

Whether the button captures modal interface input.

NextSelectionDown

ImageButton.NextSelectionDown: GuiObject? = nil

The interface element selected when navigating down from this element.

NextSelectionLeft

ImageButton.NextSelectionLeft: GuiObject? = nil

The interface element selected when navigating left from this element.

NextSelectionRight

ImageButton.NextSelectionRight: GuiObject? = nil

The interface element selected when navigating right from this element.

NextSelectionUp

ImageButton.NextSelectionUp: GuiObject? = nil

The interface element selected when navigating up from this element.

Opacity

ImageButton.Opacity: number = 1

The opacity multiplier applied to this element and its descendants.

Position

ImageButton.Position: UDim2 = UDim2.new(0, 0, 0, 0)

The element position relative to its parent. Scale components use the parent size; offsets are in pixels.

ResampleMode

The sampling method used when scaling the image.

Rotation

ImageButton.Rotation: number = 0

The interface rotation in degrees.

ScaleType

ImageButton.ScaleType: Enum.ScaleType = Enum.ScaleType.Stretch

Whether the image stretches, slices, tiles, fits, or crops to its bounds.

Selectable

ImageButton.Selectable: boolean = false

Whether interface navigation can select this element.

SelectionImageObject

ImageButton.SelectionImageObject: GuiObject? = nil

The interface element used to draw the selection indicator.

SelectionOrder

ImageButton.SelectionOrder: number = 0

The numeric order used for interface selection traversal.

Size

ImageButton.Size: UDim2 = UDim2.new(0, 0, 0, 0)

The element size relative to its parent. Scale components use the parent size; offsets are in pixels.

SizeConstraint

The parent axes used to resolve relative interface size.

SliceCenter

ImageButton.SliceCenter: Rect = Rect.new(0, 0, 0, 0)

The inner rectangle used for nine-slice image scaling.

SliceScale

ImageButton.SliceScale: number = 1

The scale applied to the borders of a nine-slice image.

TileSize

ImageButton.TileSize: UDim2 = UDim2.new(1, 0, 1, 0)

The size of one repeated tile when the image uses tile scaling.

Visible

ImageButton.Visible: boolean = true

Whether this interface element is rendered.

ZIndex

ImageButton.ZIndex: number = 1

The element's draw-order index. Interpretation depends on the root's ZIndexBehavior.

Methods

CaptureFocus

ImageButton:CaptureFocus(): ()

Gives keyboard focus to this interface element.

GetExecutionGroup

ImageButton:GetExecutionGroup(): ExecutionGroup?

Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.

ReleaseFocus

ImageButton:ReleaseFocus(): ()

Removes keyboard focus from this interface element.

Events

Activated

ImageButton.Activated: RBXScriptSignal

Fires when the button is activated by an accepted pointer, touch, or gamepad input.

DragBegin

ImageButton.DragBegin: RBXScriptSignal

Fires when pointer dragging of the element begins.

DragStopped

ImageButton.DragStopped: RBXScriptSignal

Fires when pointer dragging of the element ends.

InputBegan

ImageButton.InputBegan: RBXScriptSignal

Fires when input begins over or is dispatched to this interface element.

InputChanged

ImageButton.InputChanged: RBXScriptSignal

Fires when input dispatched to this element changes.

InputEnded

ImageButton.InputEnded: RBXScriptSignal

Fires when input dispatched to this element ends.

MouseWheelBackward

ImageButton.MouseWheelBackward: RBXScriptSignal

Fires when the mouse wheel scrolls backward over this element.

MouseWheelForward

ImageButton.MouseWheelForward: RBXScriptSignal

Fires when the mouse wheel scrolls forward over this element.

PointerEntered

ImageButton.PointerEntered: RBXScriptSignal

Fires when a pointer moves onto the button.

PointerExited

ImageButton.PointerExited: RBXScriptSignal

Fires when a pointer moves off the button.

PointerMoved

ImageButton.PointerMoved: RBXScriptSignal

Fires when the pointer moves across the button.

Pressed

ImageButton.Pressed: RBXScriptSignal

Fires when the button enters its pressed state.

Released

ImageButton.Released: RBXScriptSignal

Fires when the button leaves its pressed state.

SelectionGained

ImageButton.SelectionGained: RBXScriptSignal

Fires when interface navigation selects this element.

SelectionLost

ImageButton.SelectionLost: RBXScriptSignal

Fires when this element loses interface selection.

Inherited members

Inherited48

Example

Luau
local button = Instance.new("ImageButton")
button.Image = "astasset://ui/save.png"
button.Activated:Connect(function()
  print("save")
end)

GuiButton · ImageLabel · InputService