PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GuiObject

Show deprecated

GuiObject

Show deprecated

GuiObject is an abstract class (much like 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 GuiObject/Size and GuiObject/Position. It also has some useful read-only properties like GuiObject/AbsolutePosition, GuiObject/AbsoluteSize, and GuiObject/AbsoluteRotation. It should be noted that GuiObject can have negative sizes and render normally, though GuiObject/AnchorPoint ought to be used to better control rendering.

To manipulate the layout of a GuiObject in special ways, you can use a UIComponent class such as UIListLayout, UIPadding or UIScale.

This class defines very simple animation methods: GuiObject/TweenPosition, GuiObject/TweenSize and GuiObject/TweenSizeAndPosition are good alternatives to TweenService for beginners.

GuiObject also defines events for user input like GuiObject/MouseEnter, GuiObject/TouchTap, GuiObject/InputBegan, GuiObject/InputChanged and GuiObject/InputEnded. The last three of these mimic the events of UserinputService of the same name. Although it is possible to detect mouse button events on any GuiObject using GuiObject/InputBegan, only ImageButton and TextButton have dedicated events for these (e.g. TextButton/MouseButton1Down). This event ought not be used for general button activation since not all platforms use a mouse; see TextButton/Activated.

Properties

bool

Active

Determines whether a UI element sinks input

Vector2

AnchorPoint

Determines the origin point of a GuiObject|GUI, relative to its absolute size

Color3

BackgroundColor3

Determines aGuiObject|GUI's background color

float

BackgroundTransparency

Determines the transparency of the GuiObject|GUI's background and border

Color3

BorderColor3

Determines the color of a GuiObject|GUI's border

BorderMode

BorderMode

int

BorderSizePixel

Determines the pixel width of a GuiObject|GUI's border

bool

ClipsDescendants

Determines if descendant GuiObject|GUIs outside of the bounds of a parent GUI element should render

int

LayoutOrder

Controls the sort order of a GuiObject|GUI when used with a UIGridStyleLayout

GuiObject

NextSelectionDown

Sets the GuiObject which will be selected when the Gamepad selector is moved in this direction

GuiObject

NextSelectionLeft

Sets the GuiObject which will be selected when the Gamepad selector is moved in this direction

GuiObject

NextSelectionRight

Sets the GuiObject|GUI which will be selected when the `Enum/Gamepad selector is moved in this direction

GuiObject

NextSelectionUp

Sets the GuiObject which will be selected when the Gamepad selector is moved in this direction

UDim2

Position

Determines the pixel and scalar position of a GUI

float

Rotation

Determines the number of degrees by which a UI element is rotated

bool

Selectable

Determine whether the GuiObject|GUI can be selected by a gamepad

GuiObject

SelectionImageObject

Overrides the default selection adornment (used for gamepads)

UDim2

Size

Determine the pixel and scalar size of a GuiObject|GUI

SizeConstraint

SizeConstraint

Selects the GuiObject/Size axes that a GuiObject|GUI will be based relative to the size of its parent

float

Transparency

[Hidden] [NotReplicated]

A mixed property of BackgroundTransparency and TextTransparency

bool

Visible

Determines whether a GuiObject/GUI and its descendants will be rendered

int

ZIndex

Determines the order in which a GuiObject|GUI renders relative to other GUIs

Functions

bool

TweenPosition ( UDim2 endPosition , EasingDirection easingDirection , EasingStyle easingStyle , float time , bool override , Function callback )

Smoothly moves a GUI to a new DataType/UDim2

bool

TweenSize ( UDim2 endSize , EasingDirection easingDirection , EasingStyle easingStyle , float time , bool override , Function callback )

Smoothly resizes a GUI to a new DataType/UDim2

bool

TweenSizeAndPosition ( UDim2 endSize , UDim2 endPosition , EasingDirection easingDirection , EasingStyle easingStyle , float time , bool override , Function callback )

Smoothly moves a GUI to a new size and position

Events

RBXScriptSignal

InputBegan ( Instance input )

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

RBXScriptSignal

InputChanged ( Instance input )

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

RBXScriptSignal

InputEnded ( Instance input )

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

RBXScriptSignal

MouseEnter ( int x , int y )

Fires when a user moves their mouse into a GUI element

RBXScriptSignal

MouseLeave ( int x , int y )

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

RBXScriptSignal

MouseMoved ( int x , int y )

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

RBXScriptSignal

MouseWheelBackward ( int x , int y )

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

RBXScriptSignal

MouseWheelForward ( int x , int y )

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

RBXScriptSignal

SelectionGained ( )

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

RBXScriptSignal

SelectionLost ( )

Fired when the Gamepad selector stops focusing on the GuiObject

RBXScriptSignal

TouchLongPress ( Array touchPositions , UserInputState state )

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

RBXScriptSignal

TouchPan ( Array touchPositions , Vector2 totalTranslation , Vector2 velocity , UserInputState state )

Fires when the player moves their finger on the UI element

RBXScriptSignal

TouchPinch ( Array touchPositions , float scale , float velocity , UserInputState state )

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

RBXScriptSignal

TouchRotate ( Array touchPositions , float rotation , float velocity , UserInputState state )

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

RBXScriptSignal

TouchSwipe ( SwipeDirection swipeDirection , int numberOfTouches )

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

RBXScriptSignal

TouchTap ( Array touchPositions )

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