Skip to content

Search documentation

Enter at least two characters.

    Instance

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

    The base of the LUI object tree. Instances have names, parents, properties and an explicit lifetime.

    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.

    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 Panel = Instance.new("Frame", {Parent = Window, Name = "Content", Size = UDim2.fromOffset(260, 80)})
    Instance.new("TextLabel", {Parent = Panel, Name = "Greeting", Text = "Hello", Size = UDim2.fromOffset(200, 40)})
    local Greeting = Panel:FindFirstChild("Greeting")
    if Greeting and Greeting:IsA("TextLabel") then
    Status.Text = "Found " .. Greeting.Name
    end
    local Copy = Panel:Clone()
    Copy:Destroy() -- The original panel is still alive.
    Window.Visible = true

    Expected result: The original greeting remains, and the status says Found Greeting. Destroying the copy does not destroy the original.

    A label for finding and identifying this object in your app. It is not a filename or a globally unique ID.

    Type: string. Default: class name. Read/write field.

    Marks this object as containing sensitive data. Treat this as sticky classification, not encryption or permission to log its contents.

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

    Whether sensitive classification applies after the object and its ancestry have been considered. Clearing Sensitive does not necessarily clear an existing classification.

    Type: boolean. Default: derived sticky classification. Read-only.

    The object that owns this object. Assign a supported container to place it in the tree; nil detaches it without destroying it.

    Type: Instance?. Default: nil. Read/write field.

    The concrete class name, such as TextButton. Use IsA when a check should include base classes.

    Type: string. Default: class name. Read-only.

    Destroys this object and its children and disconnects their signals. Calling it again is safe. Removing a Parent alone does not do this cleanup.

    Destroy() -> ()

    Copies the object tree into a distinct tree. The result is not an alias of the original; give the copy a Parent before showing it.

    Clone() -> Instance

    Returns the immediate children. Use GetDescendants to include deeper levels.

    GetChildren() -> {Instance}

    Returns all objects below this one, across every level. It does not include the object itself.

    GetDescendants() -> {Instance}

    Finds an immediate child by Name, or returns nil. It does not wait for a child to appear.

    FindFirstChild(Name: string) -> Instance?

    Returns true for this class or one of its base classes. A TextButton is also a GuiObject and an Instance.

    IsA(ClassName: string) -> boolean

    Fires when an exposed property changes. It has no property-name argument: read the properties you need in the callback.

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

    Fires during destruction. Use it to release application-owned work that belongs to this object; do not recreate the dying tree from this callback.

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

    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 Instance = {
    Name: string,
    Sensitive: boolean,
    read EffectiveSensitive: boolean,
    Parent: Instance?,
    read ClassName: string,
    read Destroy: (Self: Instance) -> (),
    read Clone: (Self: Instance) -> Instance,
    read GetChildren: (Self: Instance) -> {Instance},
    read GetDescendants: (Self: Instance) -> {Instance},
    read FindFirstChild: (Self: Instance, Name: string) -> Instance?,
    read IsA: (Self: Instance, ClassName: string) -> boolean,
    read Changed: Signal,
    read Destroying: Signal,
    }

    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.