rojo/.cursor/rules/roblox/reference/engine/classes/GuiObject.yaml
2026-02-02 12:08:47 -06:00

1822 lines
64 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: GuiObject
type: class
memory_category: Gui
summary: |
An abstract class for all 2D user interface objects.
description: |
`Class.GuiObject` is an abstract class (much like `Class.BasePart`) for a 2D
user interface object. It defines all the properties relating to the display
of a graphical user interface (GUI) object such as `Class.GuiObject.Size|Size`
and `Class.GuiObject.Position|Position`. It also has some useful read‑only
properties like `Class.GuiObject.AbsolutePosition|AbsolutePosition`,
`Class.GuiObject.AbsoluteSize|AbsoluteSize`, and
`Class.GuiObject.AbsoluteRotation|AbsoluteRotation`.
To manipulate the layout of GUI objects in special ways, you can use a layout
structure such as [list/flex](../../../ui/list-flex-layouts.md) or
[grid](../../../ui/grid-table-layouts.md), and you can style them beyond their
core properties through
[appearance modifiers](../../../ui/appearance-modifiers.md).
Although it's possible to detect mouse button events on any GUI object using
`Class.GuiObject.InputBegan|InputBegan` and
`Class.GuiObject.InputEnded|InputEnded`, only `Class.ImageButton` and
`Class.TextButton` have convenient dedicated events such as
`Class.TextButton.Activated|Activated` to detect click/press.
code_samples: []
inherits:
- GuiBase2d
descendants:
- CanvasGroup
- Frame
- GuiButton
- GuiLabel
- ScrollingFrame
- TextBox
- VideoDisplay
- VideoFrame
- ViewportFrame
tags:
- NotCreatable
- NotBrowsable
deprecation_message: ''
properties:
- name: GuiObject.Active
summary: |
Determines whether this UI element sinks input.
description: |
This property determines whether the `Class.GuiObject` will sink input to
3D space, such as underlying models with a `Class.ClickDetector` class
like `Class.DragDetector`.
For `Class.GuiButton` objects (`Class.ImageButton` and
`Class.TextButton`), this property determines whether
`Class.GuiButton.Activated|Activated` fires
(`Class.GuiButton.AutoButtonColor|AutoButtonColor` will still work for
those as well). The events `Class.GuiObject.InputBegan|InputBegan`,
`Class.GuiObject.InputChanged|InputChanged`, and
`Class.GuiObject.InputEnded|InputEnded` work as normal no matter the value
of this property.
code_samples:
- TextButton-Active-Debounce
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.AnchorPoint
summary: |
Determines the origin point of a `Class.GuiObject`, relative to its
absolute size.
description: |
This property determines the origin point of a `Class.GuiObject`, relative
to its absolute size. The origin point determines from where the element
is positioned (through `Class.GuiObject.Position`) and from which the
rendered `Class.GuiObject.Size` expands.
See [here](../../../ui/position-and-size.md#anchorpoint) for illustrated
diagrams and details.
code_samples:
- AnchorPoint-Demo
type: Vector2
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.AutomaticSize
summary: |
Determines whether resizing occurs based on child content.
description: |
This property is used to automatically size parent UI objects based on the
size of its descendants. You can use this property to dynamically add text
and other content to a UI object at edit or run time, and the size will
adjust to fit that content.
When `Class.GuiObject.AutomaticSize|AutomaticSize` is set to an
`Enum.AutomaticSize` value to anything other than
`Enum.AutomaticSize|None`, this UI object may resize depending on its
child content.
For more information on how to use this property and how it works, please
see [here](../../../ui/size-modifiers.md#automatic-sizing).
code_samples:
- automaticsize-uilistlayout
type: AutomaticSize
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.BackgroundColor
summary: |
Determines the color of the `Class.GuiObject` background.
description: |
Determines the color of the `Class.GuiObject` background.
code_samples: []
type: BrickColor
tags:
- Hidden
- NotReplicated
- Deprecated
deprecation_message: |
This property is deprecated in favor of the `Datatype.Color3` property
`Class.GuiObject.BackgroundColor3`, which should be used in new work
instead.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: false
capabilities:
- UI
- name: GuiObject.BackgroundColor3
summary: |
Determines the `Class.GuiObject` background color.
description: |
This property determines the color of a `Class.GuiObject` background (the
fill color). If your element contains text, such as a `Class.TextBox`,
`Class.TextButton`, or `Class.TextLabel`, make sure the color of your
background contrasts the text's color.
Another property that determines the visual properties of the background
is `Class.GuiObject.BackgroundTransparency`; if this is set to `1`,
neither the background nor the border will render.
See also `Class.GuiObject.BorderColor3|BorderColor3`.
code_samples:
- Rainbow-Frame
type: Color3
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.BackgroundTransparency
summary: |
Determines the transparency of the `Class.GuiObject` background and
border.
description: |
This property determines the transparency of the `Class.GuiObject`
background and border. It does not, however, determine the transparency of
text if the GUI is a `Class.TextBox`, `Class.TextButton`, or
`Class.TextLabel`; text transparency is determined
`Class.TextBox.TextTransparency`, `Class.TextButton.TextTransparency`, and
`Class.TextLabel.TextTransparency` respectively.
If this property is set to `1`, neither the background nor the border will
render and the GUI background will be completely transparent.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.BorderColor
summary: |
Determines the color of the `Class.GuiObject` border.
description: |
Determines the color of the `Class.GuiObject` border.
code_samples: []
type: BrickColor
tags:
- Hidden
- NotReplicated
- Deprecated
deprecation_message: |
This property is deprecated in favor of the `Datatype.Color3` property
BorderColor3, which should be used in new work instead.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: false
capabilities:
- UI
- name: GuiObject.BorderColor3
summary: |
Determines the color of the `Class.GuiObject` border.
description: |
Determines the color of the `Class.GuiObject` rectangular border (also
known as the stroke color). This is separate from the object's
`Class.GuiObject.BackgroundColor3`. You will not be able to see the
object's border if its `Class.GuiObject.BorderSizePixel` property is set
to `0`.
Note that the `Class.UIStroke` component allows for more advanced border
effects.
code_samples:
- Button-Highlight
type: Color3
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.BorderMode
summary: |
Determines in what manner the `Class.GuiObject` border is laid out
relative to its dimensions.
description: |
This property determines in what manner the `Class.GuiObject` border is
laid out relative to its dimensions using the enum of the same name,
`Enum.BorderMode`.
Note that `Class.UIStroke` can override this property and allow for more
advanced border effects.
code_samples: []
type: BorderMode
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.BorderSizePixel
summary: |
Determines the pixel width of the `Class.GuiObject` border.
description: |
This property determines how wide the `Class.GuiObject` border renders, in
pixels. Setting this to 0 disables the border altogether.
Note that `Class.UIStroke` can override this property and allow for more
advanced border effects.
code_samples:
- Button-Highlight
type: int
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.ClipsDescendants
summary: |
Determines if descendant `Class.GuiObject|GuiObjects` outside of the
bounds of a parent GUI element should render.
description: |
This property determines if the `Class.GuiObject` will clip (make
invisible) any portion of descendant GUI elements that would otherwise
render outside the bounds of the rectangle.
Note that `Class.GuiObject.Rotation|Rotation` isn't supported by this
property. If this or any ancestor GUI has a **non‑zero**
`Class.GuiObject.Rotation|Rotation`, this property is **ignored** and
descendant GUI elements will be rendered regardless of this property's
value.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Behavior
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.Draggable
summary: |
Determines whether a `Class.GuiObject` (and its descendants) can be
dragged around the screen.
description: |
This indicates whether a `Class.GuiObject` (and its descendants) can be
dragged around the screen.
code_samples: []
type: boolean
tags:
- Deprecated
deprecation_message: |
This property is deprecated. Use `Class.UIDragDetector` instead, as it
supports more input types and can be better customized.
security:
read: None
write: None
thread_safety: ReadSafe
category: Behavior
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.GuiState
summary: |
Determines whether the player's mouse is being actively pressed on the
`Class.GuiObject` or not.
description: |
When the player's finger is being tapped and held on the
`Class.GuiObject`, the `Class.GuiObject.GuiState|GuiState` of the
`Class.GuiObject` will be set to `Enum.GuiState.Press|Press`. Similarly,
When the player's finger is being released from the `Class.GuiObject`, the
`Class.GuiObject.GuiState|GuiState` of the `Class.GuiObject` will be set
to `Enum.GuiState.Idle|Idle`, and when
`Class.GuiObject.Interactable|Interactable` is turned off on the
`Class.GuiObject`, the `Class.GuiState` of the `Class.GuiObject` will be
set to `Enum.GuiState.NonInteractable|NonInteractable`.
code_samples: []
type: GuiState
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: State
serialization:
can_load: false
can_save: true
capabilities:
- UI
- name: GuiObject.Interactable
summary: |
Determines whether the `Class.GuiButton` can be interacted with or not, or
if the `Enum.GuiState|GuiState` of the `Class.GuiObject` is changing or
not.
description: |
Determines whether the `Class.GuiButton` can be interacted with or not, or
if the `Enum.GuiState|GuiState` of the `Class.GuiObject` is changing or
not.
On a `Class.GuiButton`:
- When the `Class.GuiObject.Interactable|Interactable` setting on the
`Class.GuiButton` is set to `false`, the `Class.GuiButton` will no
longer be able to be pressed or clicked, and the
`Class.GuiObject.GuiState|GuiState` will be constantly set to
`Enum.GuiState.NonInteractable|NonInteractable`.
- When the `Class.GuiObject.Interactable|Interactable` setting on the
`Class.GuiButton` is set to `true`, the `Class.GuiButton` will behave
normally again and the `Class.GuiObject.GuiState|GuiState` will behave
normally.
On a `Class.GuiObject`:
- When the `Class.GuiObject.Interactable|Interactable` setting on the
`Class.GuiButton` is set to `false`, the
`Class.GuiObject.GuiState|GuiState` will be constantly set to
`Enum.GuiState.NonInteractable|NonInteractable`.
- When the `Class.GuiObject.Interactable|Interactable` setting on the
`Class.GuiButton` is set to `true`, the
`Class.GuiObject.GuiState|GuiState` will behave normally again.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.LayoutOrder
summary: |
Controls the sort order of the `Class.GuiObject` when used with a
`Class.UIGridStyleLayout`.
description: |
This property controls the sorting order of the `Class.GuiObject` when
using a `Class.UIGridStyleLayout` (such as `Class.UIListLayout` or
`Class.UIPageLayout`) with `Class.UIGridStyleLayout.SortOrder|SortOrder`
set to `Enum.SortOrder.LayoutOrder`. It has no functionality if the object
does not have a sibling UI layout structure.
`Class.GuiObject|GuiObjects` are sorted in ascending order where lower
values take priority over higher values. Objects with equal values fall
back to the order they were added in.
If you are unsure if you'll need to add an element between two existing
elements in the future, it's a good practice to use multiples of `100`
(`0`, `100`, `200`, etc.). This ensures a large gap of layout order values
which you can use for elements ordered in-between other elements.
See also `Class.GuiObject.ZIndex|ZIndex` which determines the object's
**rendering** order instead of sorting order.
code_samples: []
type: int
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.NextSelectionDown
summary: |
Sets the `Class.GuiObject` which will be selected when the gamepad
selector is moved downward.
description: |
This property sets the `Class.GuiObject` selected when the user moves the
[gamepad](../../../input/gamepad.md) selector downward. If this property
is empty, moving the gamepad downward will not change the selected GUI.
Moving the gamepad selector downward sets the
`Class.GuiService.SelectedObject` to this object unless the GUI is not
`Class.GuiObject.Selectable|Selectable`. Note that this property can be
set to a GUI element even if it is not
`Class.GuiObject.Selectable|Selectable`, so you should ensure that the
value of a GUI's selectable property matches your expected behavior.
See also `Class.GuiObject.NextSelectionUp|NextSelectionUp`,
`Class.GuiObject.NextSelectionLeft|NextSelectionLeft`, and
`Class.GuiObject.NextSelectionRight|NextSelectionRight`.
code_samples:
- creating-a-gamepad-selection-grid
type: GuiObject
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Selection
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.NextSelectionLeft
summary: |
Sets the `Class.GuiObject` which will be selected when the gamepad
selector is moved to the left.
description: |
This property sets the `Class.GuiObject` selected when the user moves the
[gamepad](../../../input/gamepad.md) selector to the left. If this
property is empty, moving the gamepad to the left will not change the
selected GUI.
Moving the gamepad selector to the left sets the
`Class.GuiService.SelectedObject` to this object unless the GUI is not
`Class.GuiObject.Selectable|Selectable`. Note that this property can be
set to a GUI element even if it is not
`Class.GuiObject.Selectable|Selectable`, so you should ensure that the
value of a GUI's selectable property matches your expected behavior.
See also `Class.GuiObject.NextSelectionUp|NextSelectionUp`,
`Class.GuiObject.NextSelectionDown|NextSelectionDown`, and
`Class.GuiObject.NextSelectionRight|NextSelectionRight`.
code_samples:
- creating-a-gamepad-selection-grid
type: GuiObject
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Selection
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.NextSelectionRight
summary: |
Sets the `Class.GuiObject` which will be selected when the gamepad
selector is moved to the right.
description: |
This property sets the `Class.GuiObject` selected when the user moves the
[gamepad](../../../input/gamepad.md) selector to the right. If this
property is empty, moving the gamepad to the right will not change the
selected GUI.
Moving the gamepad selector to the right sets the
`Class.GuiService.SelectedObject` to this object unless the GUI is not
`Class.GuiObject.Selectable|Selectable`. Note that this property can be
set to a GUI element even if it is not
`Class.GuiObject.Selectable|Selectable`, so you should ensure that the
value of a GUI's selectable property matches your expected behavior.
See also `Class.GuiObject.NextSelectionUp|NextSelectionUp`,
`Class.GuiObject.NextSelectionDown|NextSelectionDown`, and
`Class.GuiObject.NextSelectionLeft|NextSelectionLeft`.
code_samples:
- creating-a-gamepad-selection-grid
type: GuiObject
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Selection
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.NextSelectionUp
summary: |
Sets the `Class.GuiObject` which will be selected when the gamepad
selector is moved upward.
description: |
This property sets the `Class.GuiObject` selected when the user moves the
[gamepad](../../../input/gamepad.md) selector upward. If this property is
empty, moving the gamepad upward will not change the selected GUI.
Moving the gamepad selector upward sets the
`Class.GuiService.SelectedObject` to this object unless the GUI is not
`Class.GuiObject.Selectable|Selectable`. Note that this property can be
set to a GUI element even if it is not
`Class.GuiObject.Selectable|Selectable`, so you should ensure that the
value of a GUI's selectable property matches your expected behavior.
See also `Class.GuiObject.NextSelectionDown|NextSelectionDown`,
`Class.GuiObject.NextSelectionLeft|NextSelectionLeft`,
`Class.GuiObject.NextSelectionRight|NextSelectionRight`.
code_samples:
- creating-a-gamepad-selection-grid
type: GuiObject
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Selection
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.Position
summary: |
Determines the pixel and scalar position of the `Class.GuiObject`.
description: |
This property determines the `Class.GuiObject` pixel and scalar position
using a `Datatype.UDim2`. Position is centered around the object's
`Class.GuiObject.AnchorPoint`.
The scalar position is relative to the size of the parent GUI element, if
any.
The pixel portions of the `Datatype.UDim2` value are the same regardless
of the parent GUI's size. The values represent the position of the object
in pixels. An object's actual pixel position can be read from the
`Class.GuiBase2d.AbsolutePosition` property.
code_samples: []
type: UDim2
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.Rotation
summary: |
Determines the number of degrees by which the `Class.GuiObject` is
rotated.
description: |
This property determines the number of degrees by which the
`Class.GuiObject` is rotated. Rotation is relative to the **center** of
the object, **not** the `Class.GuiObject.AnchorPoint|AnchorPoint`, meaning
you cannot change the point of rotation. Additionally, this property is
not compatible with `Class.GuiObject.ClipsDescendants|ClipsDescendants`.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.Selectable
summary: |
Determine whether the `Class.GuiObject` can be selected by a gamepad.
description: |
This property determines whether the `Class.GuiObject` can be selected
when navigating GUIs using a gamepad.
If this property is `true`, a GUI can be selected. Selecting a GUI also
sets the `Class.GuiService.SelectedObject` property to that object.
When this is `false`, the GUI cannot be selected. However, setting this to
`false` when a GUI is selected will not deselect it nor change the value
of the `Class.GuiService.SelectedObject` property.
Add `Class.GuiObject.SelectionGained` and `Class.GuiObject.SelectionLost`
will not fire for the element. To deselect a GuiObject, you must change
the `Class.GuiService.SelectedObject` property.
This property is useful if a GUI is connected to several GUIs via
properties such as this `Class.GuiObject.NextSelectionUp`,
`Class.GuiObject.NextSelectionDown`, `Class.GuiObject|NextSelectionRight`,
or `Class.GuiObject|NextSelectionLeft`. Rather than change all of the
properties so that the Gamepad cannot select the GUI, you can disable its
Selectable property to temporarily prevent it from being selected. Then,
when you want the gamepad selector to be able to select the GUI, simply
re-enable its selectable property.
code_samples:
- limiting-textbox-selection
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Selection
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.SelectionImageObject
summary: |
Overrides the default selection adornment used for gamepads.
description: |
This property overrides the default selection adornment used for gamepads.
Note that the chosen
`Class.GuiObject.SelectionImageObject|SelectionImageObject` overlays the
selected `Class.GuiObject` with the `Class.GuiObject.Size|Size` of the
image. For best results, you should size the custom `SelectionImageObject`
via the scale `Datatype.UDim2` values to help ensure that the object
scales properly over the selected element.
Changing the `Class.GuiObject.SelectionImageObject|SelectionImageObject`
for a `Class.GuiObject` element only affects that element. To affect all
of a user's GUI elements, set the `Class.PlayerGui.SelectionImageObject`
property.
To determine or set which GUI element is selected by the user, you can use
the `Class.GuiService.SelectedObject` property. The player uses the
gamepad to select different GUI elements, invoking the
`Class.GuiObject.NextSelectionUp|NextSelectionUp`,
`Class.GuiObject.NextSelectionDown|NextSelectionDown`,
`Class.GuiObject.NextSelectionLeft|NextSelectionLeft`, and
`Class.GuiObject.NextSelectionRight|NextSelectionRight` events.
code_samples: []
type: GuiObject
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.SelectionOrder
summary: |
The order of `Class.GuiObject|GuiObjects` selected by the gamepad UI
selection.
description: |
GuiObjects with a lower SelectionOrder are selected earlier than
GuiObjects with a higher SelectionOrder when starting the gamepad
selection or calling `Class.GuiService:Select()` on an ancestor. This
property does not affect directional navigation. Default value is 0.
code_samples: []
type: int
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Selection
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.Size
summary: |
Determines the pixel and scalar size of the `Class.GuiObject`.
description: |
This property determines the `Class.GuiObject` scalar and pixel size using
a `Datatype.UDim2`.
The scalar size is relative to the size of the parent GUI element, if any.
The pixel portions of the `Datatype.UDim2` value are the same regardless
of the parent GUI's size. The values represent the size of the object in
pixels. An object's actual pixel size can be read from the
`Class.GuiBase2d.AbsoluteSize` property.
If the `Class.GuiObject` has a parent, its size along each axis is also
influenced by the parent's
`Class.GuiObject.SizeConstraint|SizeConstraint`.
code_samples:
- Health-Bar
type: UDim2
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.SizeConstraint
summary: |
Sets the `Class.GuiObject.Size|Size` axes that the `Class.GuiObject` will
be based on, relative to the size of its parent.
description: |
This property sets the `Class.GuiObject.Size|Size` axes that the
`Class.GuiObject` will be based on, relative to the size of its parent.
This property is useful for creating GUI objects that are meant to scale
with either the width **or** height of a parent object, but not both,
effectively preserving the aspect ratio of the object.
code_samples: []
type: SizeConstraint
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.Transparency
summary: |
A mixed property of
`Class.GuiObject.BackgroundTransparency|BackgroundTransparency` and
`Class.TextLabel.TextTransparency|TextTransparency`.
description: |
A mixed property of
`Class.GuiObject.BackgroundTransparency|BackgroundTransparency` and
`Class.TextLabel.TextTransparency|TextTransparency`.
code_samples: []
type: float
tags:
- Hidden
- NotReplicated
deprecation_message: |
This property is deprecated and indexing it will return
`Class.GuiObject.BackgroundTransparency|BackgroundTransparency`.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: false
capabilities:
- UI
- name: GuiObject.Visible
summary: |
Determines whether the `Class.GuiObject` and its descendants will be
rendered.
description: |
This property whether the `Class.GuiObject` and its descendants will be
rendered.
The rendering of individual components of a `Class.GuiObject` can be
controlled individually through transparency properties such as
`Class.GuiObject.BackgroundTransparency`,
`Class.TextLabel.TextTransparency` and
`Class.ImageLabel.ImageTransparency`.
When this property is `false`, the `Class.GuiObject` will be ignored by
layout structures such as `Class.UIListLayout`, `Class.UIGridLayout`, and
`Class.UITableLayout`. In other words, the space that the element would
otherwise occupy in the layout is used by other elements instead.
code_samples:
- UI-Window
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: GuiObject.ZIndex
summary: |
Determines the order in which a `Class.GuiObject` renders relative to
others.
description: |
This property determines the order in which a `Class.GuiObject` renders
relative to others.
By default, `Class.GuiObject|GuiObjects` render in ascending priority
order where those with lower `Class.GuiObject.ZIndex|ZIndex` values are
rendered under those with higher values. You can change the render order
within a `Class.ScreenGui`, `Class.SurfaceGui`, or `Class.BillboardGui` by
changing the value of its
`Class.LayerCollector.ZIndexBehavior|ZIndexBehavior`.
If you are unsure if you'll need to add an element between two existing
elements in the future, it's a good practice to use multiples of `100`
(`0`, `100`, `200`, etc.). This ensures a large gap of render order values
which you can use for elements layered in-between other elements.
See also `Class.GuiObject.LayoutOrder|LayoutOrder` which controls the
**sorting** order of a `Class.GuiObject` when used with a layout structure
such as `Class.UIListLayout` or `Class.UIGridLayout`.
code_samples: []
type: int
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
methods:
- name: GuiObject:TweenPosition
summary: |
Smoothly moves a GUI to a new `Datatype.UDim2`.
description: |
Smoothly moves a GUI to a new `Datatype.UDim2` position in the specified
time using the specified `Enum.EasingDirection` and `Enum.EasingStyle`.
This function will return whether the tween will play. It will not play if
another tween is acting on the `Class.GuiObject` and the override
parameter is `false`.
See also `Class.GuiObject:TweenSize()` and
`Class.GuiObject:TweenSizeAndPosition()`.
code_samples:
- GuiObject-TweenPosition1
parameters:
- name: endPosition
type: UDim2
default:
summary: |
Where the GUI should move to.
- name: easingDirection
type: EasingDirection
default: Out
summary: |
The direction in which to ease the GUI to the _endPosition_.
- name: easingStyle
type: EasingStyle
default: Quad
summary: |
The style in which to ease the GUI to the _endPosition_.
- name: time
type: float
default: 1
summary: |
How long, in seconds, the tween should take to complete.
- name: override
type: boolean
default: false
summary: |
Whether the tween will override an in-progress tween.
- name: callback
type: Function
default: nil
summary: |
A callback function to execute when the tween completes.
returns:
- type: boolean
summary: |
Whether the tween will play.
tags: []
deprecation_message: |
This function is deprecated in favor of using `Class.TweenService`, which
allows for better customization using an object-oriented and event-based
approach.
- The `easingDirection`, `easingStyle`, and `time` parameters are handled
by a `Datatype.TweenInfo`
- The `override` parameter is no longer relevant; tweens always override
previous tweens on the same property.
- The `callback` parameter is better suited by the `Class.Tween.Completed`
event. The `Enum.PlaybackState` enum passed by that event provides a
more detailed description of the tween's completion state.
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiObject:TweenSize
summary: |
Smoothly resizes a `Class.GuiObject` to a new `Datatype.UDim2`.
description: |
Smoothly resizes a `Class.GuiObject` to a new `Datatype.UDim2` in the
specified time using the specified `Enum.EasingDirection` and
`Enum.EasingStyle`.
This function will return whether the tween will play. Normally this will
always return `true`, but it will return `false` if another tween is
active and override is set to `false`.
See also `Class.GuiObject:TweenSize()` and
`Class.GuiObject:TweenSizeAndPosition()`.
code_samples:
- tween-a-gui-s-size
parameters:
- name: endSize
type: UDim2
default:
summary: |
The size that the GUI should resize.
- name: easingDirection
type: EasingDirection
default: Out
summary: |
The direction in which to ease the GUI to the _endSize_.
- name: easingStyle
type: EasingStyle
default: Quad
summary: |
The style in which to ease the GUI to the _endSize_.
- name: time
type: float
default: 1
summary: |
How long, in seconds, the tween should take to complete.
- name: override
type: boolean
default: false
summary: |
Whether the tween will override an in-progress tween.
- name: callback
type: Function
default: nil
summary: |
A callback function to execute when the tween completes.
returns:
- type: boolean
summary: |
Whether the tween will play.
tags: []
deprecation_message: |
This function is deprecated in favor of using `Class.TweenService`, which
allows for better customization using an object-oriented and event-based
approach.
- The `easingDirection`, `easingStyle`, and `time` parameters are handled
by a `Datatype.TweenInfo`
- The `override` parameter is no longer relevant; tweens always override
previous tweens on the same property.
- The `callback` parameter is better suited by the `Class.Tween.Completed`
event. The `Enum.PlaybackState` enum passed by that event provides a
more detailed description of the tween's completion state.
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiObject:TweenSizeAndPosition
summary: |
Smoothly moves a GUI to a new size and position.
description: |
Smoothly resizes and moves a GUI to a new `Datatype.UDim2` size and
position in the specified time using the specified `Enum.EasingDirection`
and `Enum.EasingStyle`.
This function will return whether the tween will play. Normally this will
always return `true`, but it will return `false` if another tween is
active and override is set to `false`.
See also `Class.GuiObject:TweenSize()` and
`Class.GuiObject:TweenSizeAndPosition()`.
code_samples:
- GuiObject-TweenSizeAndPosition1
parameters:
- name: endSize
type: UDim2
default:
summary: |
The size that the GUI should resize.
- name: endPosition
type: UDim2
default:
summary: |
Where the GUI should move to.
- name: easingDirection
type: EasingDirection
default: Out
summary: |
The direction in which to ease the GUI to the _endSize_ and
_endPosition_.
- name: easingStyle
type: EasingStyle
default: Quad
summary: |
The style in which to ease the GUI to the _endSize_ and _endPosition_.
- name: time
type: float
default: 1
summary: |
How long, in seconds, the tween should take to complete.
- name: override
type: boolean
default: false
summary: |
Whether the tween will override an in-progress tween.
- name: callback
type: Function
default: nil
summary: |
A callback function to execute when the tween completes.
returns:
- type: boolean
summary: |
Whether the tween will play.
tags: []
deprecation_message: |
This function is deprecated in favor of using `Class.TweenService`, which
allows for better customization using an object-oriented and event-based
approach.
- The `easingDirection`, `easingStyle`, and `time` parameters are handled
by a `Datatype.TweenInfo`
- The `override` parameter is no longer relevant; tweens always override
previous tweens on the same property.
- The `callback` parameter is better suited by the `Class.Tween.Completed`
event. The `Enum.PlaybackState` enum passed by that event provides a
more detailed description of the tween's completion state.
security: None
thread_safety: Unsafe
capabilities:
- UI
events:
- name: GuiObject.DragBegin
summary: |
Fired when a player begins dragging the object.
description: |
This event fires when a player begins dragging the object.
See also `Class.GuiObject.DragStopped`.
code_samples:
- GuiObject-DragBegin1
parameters:
- name: initialPosition
type: UDim2
default:
summary: |
A `Datatype.UDim2` value of the position of the `Class.GuiObject`
before any drag operation began.
tags:
- Deprecated
deprecation_message: |
This property is deprecated. Use `Class.UIDragDetector` instead, as it
supports more input types and can be better customized.
security: None
capabilities:
- UI
- name: GuiObject.DragStopped
summary: |
Fired when a player stops dragging the object.
description: |
This event fires when a player stops dragging the object.
See also `Class.GuiObject.DragBegin`.
code_samples:
- GuiObject-DragStopped1
parameters:
- name: x
type: int
default:
summary: |
The mouse's **X** screen location in pixels, relative to the top left
corner of the screen.
- name: 'y'
type: int
default:
summary: |
The mouse's **Y** screen location in pixels, relative to the top left
corner of the screen.
tags:
- Deprecated
deprecation_message: |
This property is deprecated. Use `Class.UIDragDetector` instead, as it
supports more input types and can be better customized.
security: None
capabilities:
- UI
- name: GuiObject.InputBegan
summary: |
Fired when a user begins interacting via a Human-Computer Interface device
(Mouse button down, touch begin, keyboard button down, etc).
description: |
This event fires when a user begins interacting with the `Class.GuiObject`
via a Human-Computer Interface device (Mouse button down, touch begin,
keyboard button down, etc).
The `Class.UserInputService` has a similarly named event that is not
restricted to a specific UI element: `Class.UserInputService.InputBegan`.
This event will always fire regardless of game state.
See also `Class.GuiObject.InputEnded` and `Class.GuiObject.InputChanged`.
code_samples:
- tracking-the-beginning-of-input-on-a-guiobject
parameters:
- name: input
type: InputObject
default:
summary: |
An `Class.InputObject`, which contains useful data for querying user
input such as the`Enum.UserInputType|type of input`,
`Enum.UserInputState|state of input`, and
`Class.InputObject.Position|screen coordinates of the input`.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.InputChanged
summary: |
Fired when a user changes how they're interacting via a Human-Computer
Interface device (Mouse button down, touch begin, keyboard button down,
etc).
description: |
This event fires when a user changes how they're interacting via a
Human-Computer Interface device (Mouse button down, touch begin, keyboard
button down, etc).
The `Class.UserInputService` has a similarly named event that is not
restricted to a specific UI element:
`Class.UserInputService.InputChanged`.
This event will always fire regardless of game state.
See also `Class.GuiObject.InputBegan` and `Class.GuiObject.InputEnded`.
code_samples:
- guiobject-inputchanged-demo
parameters:
- name: input
type: InputObject
default:
summary: |
An `Class.InputObject`, which contains useful data for querying user
input such as the`Enum.UserInputType|type of input`,
`Enum.UserInputState|state of input`, and
`Class.InputObject.Position|screen coordinates of the input`.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.InputEnded
summary: |
Fired when a user stops interacting via a Human-Computer Interface device
(Mouse button down, touch begin, keyboard button down, etc).
description: |
The InputEnded event fires when a user stops interacting via a
Human-Computer Interface device (Mouse button down, touch begin, keyboard
button down, etc).
The `Class.UserInputService` has a similarly named event that is not
restricted to a specific UI element: `Class.UserInputService.InputEnded`.
This event will always fire regardless of game state.
See also `Class.GuiObject.InputBegan` and `Class.GuiObject.InputChanged`.
code_samples:
- tracking-the-end-of-input-on-a-guiobject
parameters:
- name: input
type: InputObject
default:
summary: |
An `Class.InputObject`, which contains useful data for querying user
input such as the`Enum.UserInputType`, `Enum.UserInputState`, and
`Class.InputObject.Position`.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.MouseEnter
summary: |
Fires when a user moves their mouse into a GUI element.
description: |
The MouseEnter event fires when a user moves their mouse into a
`Class.GuiObject` element.
Please do not rely on the `x` and `y` arguments passed by this event as a
fool-proof way to determine where the user's mouse is when it enters a
GUI. These coordinates may vary even when the mouse enters the GUI via the
same edge - particularly when the mouse enters the element quickly. This
is due to the fact the coordinates indicate the position of the mouse when
the event fires rather than the exact moment the mouse enters the GUI.
This event fires even when the GUI element renders beneath another
element.
If you would like to track when a user's mouse leaves a GUI element, you
can use the `Class.GuiObject.MouseLeave` event.
##### See Also
- `Class.GuiObject.MouseLeave`
- `Class.GuiObject.MouseMoved`
- `Class.GuiObject.MouseWheelForward`
- `Class.GuiObject.MouseWheelBackward`
code_samples:
- GuiObject-MouseEnter1
parameters:
- name: x
type: int
default:
summary: |
The mouse's **X** screen coordinate in pixels, relative to the top
left corner of the screen.
- name: 'y'
type: int
default:
summary: |
The mouse's **Y** screen coordinate in pixels, relative to the top
left corner of the screen.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.MouseLeave
summary: |
Fires when a user moves their mouse out of a GUI element.
description: |
The MouseLeave event fires when a user moves their mouse out of a
`Class.GuiObject` element.
Please do not rely on the `x` and `y` arguments passed by this event as a
fool-proof way to determine where the user's mouse is when it leaves a
GUI. These coordinates may vary even when the mouse leaves the GUI via the
same edge - particularly when the mouse leaves the element quickly. This
is due to the fact the coordinates indicate the position of the mouse when
the event fires rather than the exact moment the mouse leaves the GUI.
This event fires even when the GUI element renders beneath another
element.
##### See Also
- `Class.GuiObject.MouseEnter`
- `Class.GuiObject.MouseMoved`
- `Class.GuiObject.MouseWheelForward`
- `Class.GuiObject.MouseWheelBackward`
code_samples: []
parameters:
- name: x
type: int
default:
summary: |
The mouse's **X** screen coordinate in pixels, relative to the top
left corner of the screen.
- name: 'y'
type: int
default:
summary: |
The mouse's **Y** screen coordinate in pixels, relative to the top
left corner of the screen.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.MouseMoved
summary: |
Fires whenever a user moves their mouse while it is inside a GUI element.
description: |
Fires whenever a user moves their mouse while it is inside a
`Class.GuiObject` element. It is similar to `Class.Mouse.Move`, which
fires regardless whether the user's mouse is over a GUI element.
Note, this event fires when the mouse's position is updated, therefore it
will fire repeatedly while being moved.
The `x` and `y` arguments indicate the updated screen coordinates of the
user's mouse in pixels. These can be useful to determine the mouse's
location on the GUI, screen, and delta since the mouse's previous position
if it is being tracked in a global variable.
The code below demonstrates how to determine the `Datatype.Vector2` offset
of the user's mouse relative to a GUI element:
```lua
local Players = game:GetService("Players")
local CustomScrollingFrame = script.Parent
local SubFrame = CustomScrollingFrame:FindFirstChild("SubFrame")
local mouse = Players.LocalPlayer:GetMouse()
local function getPosition(X, Y)
local gui_X = CustomScrollingFrame.AbsolutePosition.X
local gui_Y = CustomScrollingFrame.AbsolutePosition.Y
local pos = Vector2.new(math.abs(X - gui_X), math.abs(Y - gui_Y - 36))
print(pos)
end
CustomScrollingFrame.MouseMoved:Connect(getPosition)
```
Note that this event may not fire exactly when the user's mouse enters or
exits a GUI element. Therefore, the `x` and `y` arguments may not match up
perfectly to the coordinates of the GUI's edges.
##### See Also
- `Class.GuiObject.MouseEnter`
- `Class.GuiObject.MouseLeave`
- `Class.GuiObject.MouseWheelForward`
- `Class.GuiObject.MouseWheelBackward`
code_samples: []
parameters:
- name: x
type: int
default:
summary: |
The mouse's **X** screen coordinate in pixels, relative to the top
left corner of the screen.
- name: 'y'
type: int
default:
summary: |
The mouse's **Y** screen coordinate in pixels, relative to the top
left corner of the screen.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.MouseWheelBackward
summary: |
Fires when a user scrolls their mouse wheel back when the mouse is over a
GUI element.
description: |
The WheelBackward event fires when a user scrolls their mouse wheel back
when the mouse is over a `Class.GuiObject` element. It is similar to
`Class.Mouse.WheelBackward`, which fires regardless whether the user's
mouse is over a GUI element.
This event fires merely as an indicator of the wheel's backward movement.
This means that the `x` and `y` mouse coordinate arguments don't change as
a result of this event. These coordinates only change when the mouse
moves, which can be tracked by the `Class.GuiObject.MouseMoved` event.
##### See Also
- `Class.GuiObject.MouseEnter`
- `Class.GuiObject.MouseLeave`
- `Class.GuiObject.MouseMoved`
- `Class.GuiObject.MouseWheelForward`
code_samples: []
parameters:
- name: x
type: int
default:
summary: |
The mouse's **X** screen coordinate in pixels, relative to the top
left corner of the screen.
- name: 'y'
type: int
default:
summary: |
The mouse's **Y** screen coordinate in pixels, relative to the top
left corner of the screen.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.MouseWheelForward
summary: |
Fires when a user scrolls their mouse wheel forward when the mouse is over
a GUI element.
description: |
The WheelForward event fires when a user scrolls their mouse wheel forward
when the mouse is over a `Class.GuiObject` element. It is similar to
`Class.Mouse.WheelForward`, which fires regardless whether the user's
mouse is over a GUI element.
This event fires merely as an indicator of the wheel's forward movement.
This means that the **X** and **Y** mouse coordinate arguments do not
change as a result of this event. These coordinates only change when the
mouse moves, which can be tracked by the `Class.GuiObject.MouseMoved`
event.
##### See Also
- `Class.GuiObject.MouseEnter`
- `Class.GuiObject.MouseLeave`
- `Class.GuiObject.MouseMoved`
- `Class.GuiObject.MouseWheelBackward`
code_samples: []
parameters:
- name: x
type: int
default:
summary: |
The mouse's **X** screen coordinate in pixels, relative to the top
left corner of the screen.
- name: 'y'
type: int
default:
summary: |
The **Y** coordinate of the user's mouse.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.SelectionGained
summary: |
Fired when the GuiObject is being focused on with the Gamepad selector.
description: |
This event fires when the Gamepad selector starts focusing on the
`Class.GuiObject`.
If you want to check from the Gamepad select stops focusing on the GUI
element, you can use the `Class.GuiObject.SelectionLost` event.
When a GUI gains selection focus, the value of the
`Class.GuiService.SelectedObject|SelectedObject` property also changes to
the that gains selection. To determine which GUI gained selection, check
the value of this property.
code_samples:
- GuiObject-SelectionGained1
parameters: []
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.SelectionLost
summary: |
Fired when the Gamepad selector stops focusing on the GuiObject.
description: |
This event fires when the Gamepad selector stops focusing on the
`Class.GuiObject`.
If you want to check from the Gamepad select starts focusing on the GUI
element, you can use the `Class.GuiObject.SelectionGained` event.
When a GUI loses selection focus, the value of the
`Class.GuiService.SelectionObject|SelectionObject` property changes either
to `nil` or to the GUI element that gains selection focus. To determine
which GUI gained selection, or if no GUI is selected, check the value of
this property.
code_samples:
- GuiObject-SelectionLost1
parameters: []
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.TouchLongPress
summary: |
Fires when the player starts, continues and stops long-pressing the UI
element.
description: |
This event fires after a brief moment when the player holds their finger
on the UI element using a touch-enabled device. It fires with a table of
`Datatype.Vector2` that describe the relative screen positions of the
fingers involved in the gesture. In addition, it fires multiple times:
`Enum.UserInputState.Begin` after a brief delay,
`Enum.UserInputState.Change` if the player moves their finger during the
gesture, and finally `Enum.UserInputState.End`. The delay is platform
dependent; in Studio it is a little longer than one second.
Since this event only requires one finger, this event can be simulated in
Studio using the emulator and a mouse.
code_samples:
- Move-UI-Element-with-TouchLongPress
parameters:
- name: touchPositions
type: Array
default:
summary: |
An array of `Datatype.Vector2` that describe the **relative**
positions of the fingers involved in the gesture.
- name: state
type: UserInputState
default:
summary: |
A `Enum.UserInputState` that describes the state of the gesture:
- Begin fires once at the beginning of the gesture (after the brief
delay)
- Change fires if the player moves their finger while pressing down
- End fires once at the end of the gesture when they release their
finger.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.TouchPan
summary: |
Fires when the player moves their finger on the UI element.
description: |
This event fires when the player moves their finger on the UI element
using a touch-enabled device. It fires shortly before
`Class.GuiObject.TouchSwipe` would, and does not fire with
`Class.GuiObject.TouchTap`. This event is useful for allowing the player
to manipulate the position of UI elements on the screen.
This event fires with a table of `Datatype.Vector2` that describe the
relative screen positions of the fingers involved in the gesture. In
addition, it fires multiple times: `Enum.UserInputState.Begin` after a
brief delay, `Enum.UserInputState.Change` when the player moves their
finger during the gesture, and finally with `Enum.UserInputState.End`.
This event cannot be simulated in Studio using the emulator and a mouse;
you must have a real touch-enabled device to fire it.
code_samples:
- Panning-UI-Element
parameters:
- name: touchPositions
type: Array
default:
summary: |
A Luau array of `Datatype.Vector2` objects, each indicating the
position of all the fingers involved in the gesture.
- name: totalTranslation
type: Vector2
default:
summary: |
Indicates how far the pan gesture has gone from its starting point.
- name: velocity
type: Vector2
default:
summary: |
Indicates how quickly the gesture is being performed in each
dimension.
- name: state
type: UserInputState
default:
summary: |
Indicates the `Enum.UserInputState` of the gesture.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.TouchPinch
summary: |
Fires when the player performs a pinch or pull gesture using two fingers
on the UI element.
description: |
This event fires when the player uses two fingers to make a pinch or pull
gesture on the UI element using a touch-enabled device. A **pinch**
happens when two or more fingers move closer together, and a **pull**
happens when they move apart. This event fires in conjunction with
`Class.GuiObject.TouchPan`. This event is useful for allowing the player
to manipulate the scale (size) of UI elements on the screen, and is most
often used for zooming features.
This event fires with a table of `Datatype.Vector2` that describe the
relative screen positions of the fingers involved in the gesture. In
addition, it fires multiple times: `Enum.UserInputState.Begin` after a
brief delay, `Enum.UserInputState.Change` when the player moves a finger
during the gesture, and finally with `Enum.UserInputState.End`. It should
be noted that the scale should be used **multiplicatively**.
Since this event requires at least two fingers, it is not possible to
simulate it in Studio using the emulator and a mouse; you must have a real
touch-enabled device.
code_samples:
- Pinch-Pull-Scaling
parameters:
- name: touchPositions
type: Array
default:
summary: |
A Luau array of `Datatype.Vector2` objects, each indicating the
position of all the fingers involved in the pinch gesture.
- name: scale
type: float
default:
summary: |
A float that indicates the difference from the beginning of the pinch
gesture.
- name: velocity
type: float
default:
summary: |
A float indicating how quickly the pinch gesture is happening.
- name: state
type: UserInputState
default:
summary: |
Indicates the `Enum.UserInputState` of the gesture.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.TouchRotate
summary: |
Fires when the player performs a rotation gesture using two fingers on the
UI element.
description: |
This event fires when the player uses two fingers to make a pinch or pull
gesture on the UI element using a touch-enabled device. Rotation occurs
when the angle of the line between two fingers changes. This event fires
in conjunction with `Class.GuiObject.TouchPan`. This event is useful for
allowing the player to manipulate the rotation of UI elements on the
screen.
This event fires with a table of `Datatype.Vector2` that describe the
relative screen positions of the fingers involved in the gesture. In
addition, it fires multiple times: `Enum.UserInputState.Begin` after a
brief delay, `Enum.UserInputState.Change` when the player moves a finger
during the gesture, and finally with `Enum.UserInputState.End`.
Since this event requires at least two fingers, it is not possible to be
simulated in Studio using the emulator and a mouse; you must have a real
touch-enabled device.
code_samples:
- Touch-Rotation
parameters:
- name: touchPositions
type: Array
default:
summary: |
A Luau array of `Datatype.Vector2` objects, each indicating the
position of all the fingers involved in the gesture.
- name: rotation
type: float
default:
summary: |
A float indicating how much the rotation has gone from the start of
the gesture.
- name: velocity
type: float
default:
summary: |
A float that indicates how quickly the gesture is being performed.
- name: state
type: UserInputState
default:
summary: |
Indicates the `Enum.UserInputState` of the gesture.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.TouchSwipe
summary: |
Fires when the player performs a swipe gesture on the UI element.
description: |
This event fires when the player performs a swipe gesture on the UI
element using a touch-enabled device. It fires with the direction of the
gesture (Up, Down, Left or Right) and the number of touch points involved
in the gesture. Swipe gestures are often used to change tabs in mobile
UIs.
Since this event only requires one finger, it can be simulated in Studio
using the emulator and a mouse.
code_samples:
- Bouncing-Color-Picker
parameters:
- name: swipeDirection
type: SwipeDirection
default:
summary: |
A `Enum.SwipeDirection` indicating the direction of the swipe gesture
(Up, Down, Left or Right).
- name: numberOfTouches
type: int
default:
summary: |
The number of touch points involved in the gesture (usually 1).
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
- name: GuiObject.TouchTap
summary: |
Fires when the player performs a tap gesture on the UI element.
description: |
This event fires when the player performs a tap gesture on the UI element
using a touch-enabled device. A tap is a quick single touch without any
movement involved (a longer press would fire
`Class.GuiObject.TouchLongPress`, and moving during the touch would fire
`Class.GuiObject.TouchPan` and/or `Class.GuiObject.TouchSwipe`). It fires
with a table of `Datatype.Vector2` objects that describe the relative
positions of the fingers involved in the gesture.
Since this event only requires one finger, it can be simulated in Studio
using the emulator and a mouse.
code_samples:
- Tap-Transparency-Toggle
parameters:
- name: touchPositions
type: Array
default:
summary: |
An array of `Datatype.Vector2` that describe the **relative**
positions of the fingers involved in the gesture.
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
callbacks: []