List GUI elements under a root
list-gui-elementsEnumerate the live GUI tree under a root Instance to discover on-screen UI elements, their paths, classes, and text for targeted interaction.
Instructions
Enumerate the live GUI tree under a root Instance (defaults to the LocalPlayer's PlayerGui) and return a flat list of every GuiObject it contains. This is the fastest way to discover what UI is actually on screen — the exact paths, classes and current Text — so you can then read or drive a specific element with get-gui-text, set-gui-text, click-button or type-text-box. Walks root:GetDescendants() with each property access pcall-guarded so a single hostile element never aborts the scan. For every descendant that is (or, with classFilter, exactly matches) a GuiObject it records { path = GetFullName(), class = ClassName, name = Name, Visible, Text } where Visible and Text are only present when readable. Output is capped at limit; when more elements exist than the cap, truncated is true. Returns { count, truncated, elements } or { error }. Signature: { root: any?, classFilter: string?, limit: any?, threadContext: number? }. Phase: observe; cost=medium; idempotency=read-only. Requires: active-client. Produces: bounded-candidates. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| root | No | Luau expression resolving to the Instance whose descendant GUI tree to list. Defaults to 'game:GetService("Players").LocalPlayer.PlayerGui'. Pass a deeper expression such as 'game:GetService("CoreGui")' or 'game.Players.LocalPlayer.PlayerGui.MainMenu' to scope the walk. Evaluated as `return <root>`. | game:GetService("Players").LocalPlayer.PlayerGui |
| limit | No | Maximum number of elements to return (default 200). The walk stops adding once this many matches are collected and sets `truncated` to true so you know to scope the root or filter more tightly. | |
| classFilter | No | Optional exact ClassName to keep, e.g. 'TextButton', 'TextLabel', 'TextBox', 'ImageButton', 'Frame'. When set, only descendants whose ClassName equals this string are returned. When omitted, every GuiObject (IsA('GuiObject')) is returned. Case-sensitive. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |