# GuiObject

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [GuiBase2d](https://rapi.sleaze.dev/classes/GuiBase2d.md), [GuiBase](https://rapi.sleaze.dev/classes/GuiBase.md), [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Subclasses: [CanvasGroup](https://rapi.sleaze.dev/classes/CanvasGroup.md), [Frame](https://rapi.sleaze.dev/classes/Frame.md), [GuiButton](https://rapi.sleaze.dev/classes/GuiButton.md), [GuiLabel](https://rapi.sleaze.dev/classes/GuiLabel.md), [InputActionLabel](https://rapi.sleaze.dev/classes/InputActionLabel.md), [RelativeGui](https://rapi.sleaze.dev/classes/RelativeGui.md), [ScrollingFrame](https://rapi.sleaze.dev/classes/ScrollingFrame.md), [TextBox](https://rapi.sleaze.dev/classes/TextBox.md), [TextChannelWindow](https://rapi.sleaze.dev/classes/TextChannelWindow.md), [VideoDisplay](https://rapi.sleaze.dev/classes/VideoDisplay.md), [VideoFrame](https://rapi.sleaze.dev/classes/VideoFrame.md), [ViewportFrame](https://rapi.sleaze.dev/classes/ViewportFrame.md)
- Tags: Not browsable, Not creatable
- Memory category: Gui
- HTML page: https://rapi.sleaze.dev/classes/GuiObject/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/GuiObject

An abstract class for all 2D user interface objects.

## Properties

### SelectionImageObject

```luau
GuiObject.SelectionImageObject: GuiObject
```

- Tags: Read capabilities: UI

Overrides the default selection adornment used for gamepads.

### ClipsDescendants

```luau
GuiObject.ClipsDescendants: boolean
```

- Tags: Read capabilities: UI

Determines if descendant `GuiObjects` outside of the bounds of a parent GUI element should render.

### Draggable

```luau
GuiObject.Draggable: boolean
```

- Tags: Deprecated, Read capabilities: UI

**Deprecated:** This property is deprecated. Use [`UIDragDetector`](https://rapi.sleaze.dev/classes/UIDragDetector.md) instead, as it supports more input types and can be better customized.

Determines whether a [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) (and its descendants) can be dragged around the screen.

### Active

```luau
GuiObject.Active: boolean
```

- Tags: Read capabilities: UI

Determines whether this UI element sinks input.

### AnchorPoint

```luau
GuiObject.AnchorPoint: Vector2
```

- Tags: Read capabilities: UI

Determines the origin point of a [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md), relative to its absolute size.

### AutomaticSize

```luau
GuiObject.AutomaticSize: Enum.AutomaticSize
```

- Tags: Read capabilities: UI

Determines whether resizing occurs based on child content.

### BackgroundColor3

```luau
GuiObject.BackgroundColor3: Color3
```

- Tags: Read capabilities: UI

Determines the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) background color.

### BackgroundTransparency

```luau
GuiObject.BackgroundTransparency: number
```

- Tags: Read capabilities: UI

Determines the transparency of the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) background and border.

### BorderColor3

```luau
GuiObject.BorderColor3: Color3
```

- Tags: Read capabilities: UI

Determines the color of the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) border.

### BorderMode

```luau
GuiObject.BorderMode: Enum.BorderMode
```

- Tags: Read capabilities: UI

Determines in what manner the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) border is laid out relative to its dimensions.

### BorderSizePixel

```luau
GuiObject.BorderSizePixel: number
```

- Tags: Read capabilities: UI

Determines the pixel width of the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) border.

### InputSink

```luau
GuiObject.InputSink: Enum.InputSink
```

- Tags: Not replicated, Read capabilities: UI

Controls whether, and how, the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) sinks input that occurs over it.

### Interactable

```luau
GuiObject.Interactable: boolean
```

- Tags: Read capabilities: UI

Determines whether the [`GuiButton`](https://rapi.sleaze.dev/classes/GuiButton.md) can be interacted with or not, or if the [`GuiState`](https://rapi.sleaze.dev/classes/GuiObject.md) of the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) is changing or not.

### LayoutOrder

```luau
GuiObject.LayoutOrder: number
```

- Tags: Read capabilities: UI

Controls the sort order of the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) when used with a [`UIGridStyleLayout`](https://rapi.sleaze.dev/classes/UIGridStyleLayout.md).

### Position

```luau
GuiObject.Position: UDim2
```

- Tags: Read capabilities: UI

Determines the pixel and scalar position of the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md).

### Rotation

```luau
GuiObject.Rotation: number
```

- Tags: Read capabilities: UI

Determines the number of degrees by which the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) is rotated.

### SelectionRect2D

```luau
GuiObject.SelectionRect2D: Rect
```

- Tags: Hidden, Read only, Roblox script security, Thread unsafe, Read capabilities: UI

### Sink

```luau
GuiObject.Sink: Enum.InputSink
```

- Tags: Hidden, Not scriptable, Read: Roblox engine security, Read capabilities: UI

### Size

```luau
GuiObject.Size: UDim2
```

- Tags: Read capabilities: UI

Determines the pixel and scalar size of the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md).

### SizeConstraint

```luau
GuiObject.SizeConstraint: Enum.SizeConstraint
```

- Tags: Read capabilities: UI

Sets the [`Size`](https://rapi.sleaze.dev/classes/GuiObject.md) axes that the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) will be based on, relative to the size of its parent.

### Visible

```luau
GuiObject.Visible: boolean
```

- Tags: Read capabilities: UI

Determines whether the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) and its descendants will be rendered.

### ZIndex

```luau
GuiObject.ZIndex: number
```

- Tags: Read capabilities: UI

Determines the order in which a [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) renders relative to others.

### BackgroundColor

```luau
GuiObject.BackgroundColor: BrickColor
```

- Tags: Deprecated, Hidden, Not replicated, Read capabilities: UI, Load only

**Deprecated:** This property is deprecated in favor of the [`Color3`](https://rapi.sleaze.dev/index/types/Color3.md) property [`GuiObject.BackgroundColor3`](https://rapi.sleaze.dev/classes/GuiObject.md), which should be used in new work instead.

Determines the color of the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) background.

### BorderColor

```luau
GuiObject.BorderColor: BrickColor
```

- Tags: Deprecated, Hidden, Not replicated, Read capabilities: UI, Load only

**Deprecated:** This property is deprecated in favor of the [`Color3`](https://rapi.sleaze.dev/index/types/Color3.md) property BorderColor3, which should be used in new work instead.

Determines the color of the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) border.

### Transparency

```luau
GuiObject.Transparency: number
```

- Tags: Deprecated, Hidden, Not replicated, Read capabilities: UI, Load only

**Deprecated:** This property is deprecated and indexing it will return [`BackgroundTransparency`](https://rapi.sleaze.dev/classes/GuiObject.md).

A mixed property of [`BackgroundTransparency`](https://rapi.sleaze.dev/classes/GuiObject.md) and `TextTransparency`.

### DragBeginConnectionCount

```luau
GuiObject.DragBeginConnectionCount: number
```

- Tags: Hidden, Not scriptable, Read capabilities: UI

### DragStoppedConnectionCount

```luau
GuiObject.DragStoppedConnectionCount: number
```

- Tags: Hidden, Not scriptable, Read capabilities: UI

### MouseEnterConnectionCount

```luau
GuiObject.MouseEnterConnectionCount: number
```

- Tags: Hidden, Not scriptable, Read capabilities: UI

### MouseLeaveConnectionCount

```luau
GuiObject.MouseLeaveConnectionCount: number
```

- Tags: Hidden, Not scriptable, Read capabilities: UI

### MouseMovedConnectionCount

```luau
GuiObject.MouseMovedConnectionCount: number
```

- Tags: Hidden, Not scriptable, Read capabilities: UI

### MouseWheelBackwardConnectionCount

```luau
GuiObject.MouseWheelBackwardConnectionCount: number
```

- Tags: Hidden, Not scriptable, Read capabilities: UI

### MouseWheelForwardConnectionCount

```luau
GuiObject.MouseWheelForwardConnectionCount: number
```

- Tags: Hidden, Not scriptable, Read capabilities: UI

### NextSelectionDown

```luau
GuiObject.NextSelectionDown: GuiObject
```

- Tags: Read capabilities: UI

Sets the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) which will be selected when the gamepad selector is moved downward.

### NextSelectionLeft

```luau
GuiObject.NextSelectionLeft: GuiObject
```

- Tags: Read capabilities: UI

Sets the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) which will be selected when the gamepad selector is moved to the left.

### NextSelectionRight

```luau
GuiObject.NextSelectionRight: GuiObject
```

- Tags: Read capabilities: UI

Sets the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) which will be selected when the gamepad selector is moved to the right.

### NextSelectionUp

```luau
GuiObject.NextSelectionUp: GuiObject
```

- Tags: Read capabilities: UI

Sets the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) which will be selected when the gamepad selector is moved upward.

### Selectable

```luau
GuiObject.Selectable: boolean
```

- Tags: Read capabilities: UI

Determine whether the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) can be selected by a gamepad.

### SelectionOrder

```luau
GuiObject.SelectionOrder: number
```

- Tags: Read capabilities: UI

The order of `GuiObjects` selected by the gamepad UI selection.

### GuiState

```luau
GuiObject.GuiState: Enum.GuiState
```

- Tags: Read only, Read capabilities: UI, Save only

Determines whether the player's mouse is being actively pressed on the [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) or not.

## Methods

### TweenPositionInternal

```luau
GuiObject:TweenPositionInternal(endPosition: UDim2, easingDirection: Enum.EasingDirection? = Enum.EasingDirection.Out, easingStyle: Enum.EasingStyle? = Enum.EasingStyle.Quad, time: number? = 1, override: boolean? = false, callback: ((...any) -> ...any)? = nil): boolean
```

- Tags: Roblox script security, Capabilities: UI

### TweenSizeAndPositionInternal

```luau
GuiObject:TweenSizeAndPositionInternal(endSize: UDim2, endPosition: UDim2, easingDirection: Enum.EasingDirection? = Enum.EasingDirection.Out, easingStyle: Enum.EasingStyle? = Enum.EasingStyle.Quad, time: number? = 1, override: boolean? = false, callback: ((...any) -> ...any)? = nil): boolean
```

- Tags: Roblox script security, Capabilities: UI

### TweenSizeInternal

```luau
GuiObject:TweenSizeInternal(endSize: UDim2, easingDirection: Enum.EasingDirection? = Enum.EasingDirection.Out, easingStyle: Enum.EasingStyle? = Enum.EasingStyle.Quad, time: number? = 1, override: boolean? = false, callback: ((...any) -> ...any)? = nil): boolean
```

- Tags: Roblox script security, Capabilities: UI

### TweenPosition

```luau
GuiObject:TweenPosition(endPosition: UDim2, easingDirection: Enum.EasingDirection? = Enum.EasingDirection.Out, easingStyle: Enum.EasingStyle? = Enum.EasingStyle.Quad, time: number? = 1, override: boolean? = false, callback: ((...any) -> ...any)? = nil): boolean
```

- Tags: Deprecated, Capabilities: UI

**Deprecated:** This function is deprecated in favor of using [`TweenService`](https://rapi.sleaze.dev/classes/TweenService.md), which allows for better customization using an object-oriented and event-based approach.

- The `easingDirection`, `easingStyle`, and `time` parameters are handled by a [`TweenInfo`](https://rapi.sleaze.dev/index/types/TweenInfo.md)
- The `override` parameter is no longer relevant; tweens always override previous tweens on the same property.
- The `callback` parameter is better suited by the [`Tween.Completed`](https://rapi.sleaze.dev/classes/TweenBase.md) event. The `PlaybackState` enum passed by that event provides a more detailed description of the tween's completion state.

Smoothly moves a GUI to a new [`UDim2`](https://rapi.sleaze.dev/index/types/UDim2.md).

Parameters:

- `endPosition`: Where the GUI should move to.
- `easingDirection`: The direction in which to ease the GUI to the *endPosition*.
- `easingStyle`: The style in which to ease the GUI to the *endPosition*.
- `time`: How long, in seconds, the tween should take to complete.
- `override`: Whether the tween will override an in-progress tween.
- `callback`: A callback function to execute when the tween completes.

Returns: Whether the tween will play.

### TweenSize

```luau
GuiObject:TweenSize(endSize: UDim2, easingDirection: Enum.EasingDirection? = Enum.EasingDirection.Out, easingStyle: Enum.EasingStyle? = Enum.EasingStyle.Quad, time: number? = 1, override: boolean? = false, callback: ((...any) -> ...any)? = nil): boolean
```

- Tags: Deprecated, Capabilities: UI

**Deprecated:** This function is deprecated in favor of using [`TweenService`](https://rapi.sleaze.dev/classes/TweenService.md), which allows for better customization using an object-oriented and event-based approach.

- The `easingDirection`, `easingStyle`, and `time` parameters are handled by a [`TweenInfo`](https://rapi.sleaze.dev/index/types/TweenInfo.md)
- The `override` parameter is no longer relevant; tweens always override previous tweens on the same property.
- The `callback` parameter is better suited by the [`Tween.Completed`](https://rapi.sleaze.dev/classes/TweenBase.md) event. The `PlaybackState` enum passed by that event provides a more detailed description of the tween's completion state.

Smoothly resizes a [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md) to a new [`UDim2`](https://rapi.sleaze.dev/index/types/UDim2.md).

Parameters:

- `endSize`: The size that the GUI should resize.
- `easingDirection`: The direction in which to ease the GUI to the *endSize*.
- `easingStyle`: The style in which to ease the GUI to the *endSize*.
- `time`: How long, in seconds, the tween should take to complete.
- `override`: Whether the tween will override an in-progress tween.
- `callback`: A callback function to execute when the tween completes.

Returns: Whether the tween will play.

### TweenSizeAndPosition

```luau
GuiObject:TweenSizeAndPosition(endSize: UDim2, endPosition: UDim2, easingDirection: Enum.EasingDirection? = Enum.EasingDirection.Out, easingStyle: Enum.EasingStyle? = Enum.EasingStyle.Quad, time: number? = 1, override: boolean? = false, callback: ((...any) -> ...any)? = nil): boolean
```

- Tags: Deprecated, Capabilities: UI

**Deprecated:** This function is deprecated in favor of using [`TweenService`](https://rapi.sleaze.dev/classes/TweenService.md), which allows for better customization using an object-oriented and event-based approach.

- The `easingDirection`, `easingStyle`, and `time` parameters are handled by a [`TweenInfo`](https://rapi.sleaze.dev/index/types/TweenInfo.md)
- The `override` parameter is no longer relevant; tweens always override previous tweens on the same property.
- The `callback` parameter is better suited by the [`Tween.Completed`](https://rapi.sleaze.dev/classes/TweenBase.md) event. The `PlaybackState` enum passed by that event provides a more detailed description of the tween's completion state.

Smoothly moves a GUI to a new size and position.

Parameters:

- `endSize`: The size that the GUI should resize.
- `endPosition`: Where the GUI should move to.
- `easingDirection`: The direction in which to ease the GUI to the *endSize* and *endPosition*.
- `easingStyle`: The style in which to ease the GUI to the *endSize* and *endPosition*.
- `time`: How long, in seconds, the tween should take to complete.
- `override`: Whether the tween will override an in-progress tween.
- `callback`: A callback function to execute when the tween completes.

Returns: Whether the tween will play.

## Events

### InputBegan

```luau
GuiObject.InputBegan: RBXScriptSignal<(input: InputObject)>
```

- Tags: Capabilities: UI

Fired when a user begins interacting via a Human-Computer Interface device (Mouse button down, touch begin, keyboard button down, etc).

### InputChanged

```luau
GuiObject.InputChanged: RBXScriptSignal<(input: InputObject)>
```

- Tags: Capabilities: UI

Fired when a user changes how they're interacting via a Human-Computer Interface device (Mouse button down, touch begin, keyboard button down, etc).

### InputEnded

```luau
GuiObject.InputEnded: RBXScriptSignal<(input: InputObject)>
```

- Tags: Capabilities: UI

Fired when a user stops interacting via a Human-Computer Interface device (Mouse button down, touch begin, keyboard button down, etc).

### MouseEnter

```luau
GuiObject.MouseEnter: RBXScriptSignal<(x: number, y: number)>
```

- Tags: Capabilities: UI

Fires when a user moves their mouse into a GUI element.

### MouseLeave

```luau
GuiObject.MouseLeave: RBXScriptSignal<(x: number, y: number)>
```

- Tags: Capabilities: UI

Fires when a user moves their mouse out of a GUI element.

### MouseMoved

```luau
GuiObject.MouseMoved: RBXScriptSignal<(x: number, y: number)>
```

- Tags: Capabilities: UI

Fires whenever a user moves their mouse while it is inside a GUI element.

### MouseWheelBackward

```luau
GuiObject.MouseWheelBackward: RBXScriptSignal<(x: number, y: number)>
```

- Tags: Capabilities: UI

Fires when a user scrolls their mouse wheel back when the mouse is over a GUI element.

### MouseWheelForward

```luau
GuiObject.MouseWheelForward: RBXScriptSignal<(x: number, y: number)>
```

- Tags: Capabilities: UI

Fires when a user scrolls their mouse wheel forward when the mouse is over a GUI element.

### SelectionGained

```luau
GuiObject.SelectionGained: RBXScriptSignal<()>
```

- Tags: Capabilities: UI

Fired when the GuiObject is being focused on with the Gamepad selector.

### SelectionLost

```luau
GuiObject.SelectionLost: RBXScriptSignal<()>
```

- Tags: Capabilities: UI

Fired when the Gamepad selector stops focusing on the GuiObject.

### TouchLongPress

```luau
GuiObject.TouchLongPress: RBXScriptSignal<(touchPositions: { any }, state: Enum.UserInputState)>
```

- Tags: Capabilities: UI

Fires when the player starts, continues and stops long-pressing the UI element.

### TouchPan

```luau
GuiObject.TouchPan: RBXScriptSignal<(touchPositions: { any }, totalTranslation: Vector2, velocity: Vector2, state: Enum.UserInputState)>
```

- Tags: Capabilities: UI

Fires when the player moves their finger on the UI element.

### TouchPinch

```luau
GuiObject.TouchPinch: RBXScriptSignal<(touchPositions: { any }, scale: number, velocity: number, state: Enum.UserInputState)>
```

- Tags: Capabilities: UI

Fires when the player performs a pinch or pull gesture using two fingers on the UI element.

### TouchRotate

```luau
GuiObject.TouchRotate: RBXScriptSignal<(touchPositions: { any }, rotation: number, velocity: number, state: Enum.UserInputState)>
```

- Tags: Capabilities: UI

Fires when the player performs a rotation gesture using two fingers on the UI element.

### TouchSwipe

```luau
GuiObject.TouchSwipe: RBXScriptSignal<(swipeDirection: Enum.SwipeDirection, numberOfTouches: number)>
```

- Tags: Capabilities: UI

Fires when the player performs a swipe gesture on the UI element.

### TouchTap

```luau
GuiObject.TouchTap: RBXScriptSignal<(touchPositions: { any })>
```

- Tags: Capabilities: UI

Fires when the player performs a tap gesture on the UI element.

### DragBegin

```luau
GuiObject.DragBegin: RBXScriptSignal<(initialPosition: UDim2)>
```

- Tags: Deprecated, Capabilities: UI

**Deprecated:** This property is deprecated. Use [`UIDragDetector`](https://rapi.sleaze.dev/classes/UIDragDetector.md) instead, as it supports more input types and can be better customized.

Fired when a player begins dragging the object.

### DragStopped

```luau
GuiObject.DragStopped: RBXScriptSignal<(x: number, y: number)>
```

- Tags: Deprecated, Capabilities: UI

**Deprecated:** This property is deprecated. Use [`UIDragDetector`](https://rapi.sleaze.dev/classes/UIDragDetector.md) instead, as it supports more input types and can be better customized.

Fired when a player stops dragging the object.

## Inherited members

- From [GuiBase2d](https://rapi.sleaze.dev/classes/GuiBase2d.md): `AbsolutePosition`, `AbsoluteRotation`, `AbsoluteSize`, `ActiveQueryNames`, `ReplicatedInsertionOrder`, `ClippedRect`, `IsNotOccluded`, `RawRect2D`, `TotalGroupScale`, `AutoLocalize`, `RootLocalizationTable`, `Localize`, `SelectionBehaviorDown`, `SelectionBehaviorLeft`, `SelectionBehaviorRight`, `SelectionBehaviorUp`, `SelectionGroup`, `SelectionChanged`
- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
