Skip to content

Search documentation

Enter at least two characters.

    GuiObject

    SDK 0.1.0-preview.2 · ExperimentalDownload & release notes ↗

    The shared base for visual objects: geometry, visibility, styling, focus and input.

    Shared base class. You normally create a concrete control such as TextButton or Frame, then use the inherited members documented here.

    Create: This base class cannot be created directly. Inherits: Instance.

    Parent and children: Use Window, Frame or ScrollingFrame as the Parent. Child support depends on the concrete subclass.

    Where to put it: replace Src/Main.luau in a project created with this SDK. This is the complete entry file.

    local Window = Instance.new("Window", {
    Title = "LUI example", Size = UDim2.fromOffset(560, 280),
    })
    local Status = Instance.new("TextLabel", {
    Parent = Window, Text = "Ready", Position = UDim2.fromOffset(16, 170),
    Size = UDim2.new(1, -32, 0, 72),
    })
    local Button = Instance.new("TextButton", {
    Parent = Window, Text = "Try it", Size = UDim2.fromOffset(220, 44),
    Position = UDim2.fromOffset(16, 16),
    })
    Button.AnchorPoint = Vector2.new(0.5, 0)
    Button.Position = UDim2.new(0.5, 0, 0, 16)
    Button.BackgroundColor3 = Color3.fromRGB(40, 100, 180)
    Button.AccessibilityLabel = "Continue to the next screen"
    Button.Activated:Connect(function() Status.Text = "Activated" end)
    Window.Visible = true

    Expected result: A centered button appears. It inherits geometry, color and accessible naming from GuiObject. GuiObject itself cannot be created.

    Whether this object participates in the visible interface. A hidden ancestor also hides its descendants.

    Type: boolean. Default: true. Read/write field.

    A short accessible name, such as Search households. Provide one when the visible content does not identify the control clearly.

    Type: string. Default: empty string. Read/write field.

    Additional accessible guidance. Keep the main name in AccessibilityLabel; avoid repeating it here.

    Type: string. Default: empty string. Read/write field.

    Width and height relative to the parent. Each axis combines a proportion of the parent with a logical-unit offset.

    Type: UDim2. Default: 100% of parent. Read/write field.

    Position relative to the parent’s content area. A layout helper can arrange children instead of manual positioning.

    Type: UDim2. Default: 0,0. Read/write field.

    The point within the object aligned to Position. Vector2.new(0.5, 0.5) anchors its center; (0, 0) anchors its top-left corner.

    Type: Vector2. Default: 0,0. Read/write field.

    Ordering value used by list/grid layout. Use it to arrange children without depending on their names.

    Type: number. Default: 0. Read/write field.

    Background color. nil leaves color selection to the native/theme behavior.

    Type: Color3?. Default: nil (native/theme). Read/write field.

    Background transparency from 0 (opaque) to 1 (fully transparent). It does not set the opacity of the entire object.

    Type: number. Default: 0. Read/write field.

    Border color; nil leaves it to native/theme behavior. BorderSizePixel controls its thickness.

    Type: Color3?. Default: nil (native/theme). Read/write field.

    Border thickness in logical units despite the historical Pixel suffix.

    Type: number. Default: 0. Read/write field.

    Rounded-corner radius in logical units, subject to the selected host’s control mapping.

    Type: number. Default: 0. Read/write field.

    Overall opacity from 0 (invisible) to 1 (fully opaque), distinct from background transparency.

    Type: number. Default: 1. Read/write field.

    Text color. nil inherits the applicable text/theme color.

    Type: Color3?. Default: nil (inherited/theme). Read/write field.

    Text size in logical units. nil inherits it; the shared fallback is 14.

    Type: number?. Default: nil (inherit; default 14 logical units). Read/write field.

    Font family name. nil inherits it; the fallback is System. Font availability still depends on the machine.

    Type: string?. Default: nil (inherit; default System). Read/write field.

    Normal or Bold. nil inherits the weight.

    Type: string?. Default: nil (inherit; Normal or Bold). Read/write field.

    Whether text wraps within its available width. Native editing and display controls still have their documented limits.

    Type: boolean. Default: true. Read/write field.

    Horizontal text alignment: Left, Center or Right.

    Type: string. Default: Left. Read/write field.

    Vertical text alignment: Top, Center or Bottom.

    Type: string. Default: Top. Read/write field.

    Relative stacking order for overlapping content. Use ordinary containers/layout before depending on overlap.

    Type: number. Default: 0. Read/write field.

    Clips children to this object’s bounds. ScrollingFrame always clips even if this property is set to false.

    Type: boolean. Default: false; ScrollingFrame always clips. Read/write field.

    Whether this object currently has input focus.

    Type: boolean. Default: false. Read-only.

    Resolved logical position after parent layout. It is a measurement, not an input property.

    Type: Vector2. Default: derived. Read-only.

    Resolved logical width and height after layout, including constraints.

    Type: Vector2. Default: derived. Read-only.

    Requests input focus and returns whether it was accepted. Focusability and visibility depend on the control and host.

    Focus() -> boolean

    Fires when the object gains focus. No arguments are passed.

    Type: Signal. Subscribe with :Connect(function(...) ... end).

    Fires when the object loses focus. No arguments are passed.

    Type: Signal. Subscribe with :Connect(function(...) ... end).

    Fires when the mouse enters the object. No arguments are passed; use InputChanged when you need a pointer position.

    Type: Signal. Subscribe with :Connect(function(...) ... end).

    Fires when the mouse leaves the object. No arguments are passed.

    Type: Signal. Subscribe with :Connect(function(...) ... end).

    Receives an InputEvent for a pointer press or key press. Check Device before reading pointer-only fields.

    Type: InputSignal. Subscribe with :Connect(function(...) ... end).

    Receives a changed input record, such as pointer movement. Position is local logical geometry, not a screen-pixel coordinate.

    Type: InputSignal. Subscribe with :Connect(function(...) ... end).

    Receives released or canceled input. For pointer input, inspect IsCanceled before treating it as a completed action.

    Type: InputSignal. Subscribe with :Connect(function(...) ... end).

    You can use these directly on GuiObject. Follow a member link for its explanation and example.

    Name · Sensitive · EffectiveSensitive · Parent · ClassName · Destroy · Clone · GetChildren · GetDescendants · FindFirstChild · IsA · Changed · Destroying

    Full type declaration — for type checking and deeper reference

    The declaration is generated from the SDK. Self is supplied by a colon call; read means the field cannot be assigned. See how to read this reference.

    export type GuiObject = Instance & {
    Visible: boolean,
    AccessibilityLabel: string,
    AccessibilityDescription: string,
    Size: UDim2,
    Position: UDim2,
    AnchorPoint: Vector2,
    LayoutOrder: number,
    BackgroundColor3: Color3?,
    BackgroundTransparency: number,
    BorderColor3: Color3?,
    BorderSizePixel: number,
    CornerRadius: number,
    Opacity: number,
    TextColor3: Color3?,
    TextSize: number?,
    FontFamily: string?,
    FontWeight: string?,
    TextWrapped: boolean,
    TextXAlignment: string,
    TextYAlignment: string,
    ZIndex: number,
    ClipsDescendants: boolean,
    read IsFocused: boolean,
    read AbsolutePosition: Vector2,
    read AbsoluteSize: Vector2,
    read Focus: (Self: GuiObject) -> boolean,
    read Focused: Signal,
    read FocusLost: Signal,
    read MouseEnter: Signal,
    read MouseLeave: Signal,
    read InputBegan: InputSignal,
    read InputChanged: InputSignal,
    read InputEnded: InputSignal,
    }

    See platform limits before relying on host-specific behavior. The framework design specification and reflection/type sources are deeper engineering references, not extra setup required to build an app.