Skip to Content

UI

Client service for on-screen messages, windows and panels, and access to StarterGui widgets.

local UI = game:GetService("UI")

Windows and panels are containers for widgets.

Methods

ShowMessage

UI:ShowMessage(text: string, seconds: number?)

Displays text near the top of the local player's screen for seconds (default 4). Pass 0 to keep it until cleared. For a message shown to every player, call game:Message on the server.

ClearMessage

UI:ClearMessage()

Clears the message set by ShowMessage.

FindFirstChild

UI:FindFirstChild(name: string): Widget?

Returns the StarterGui widget with the given name, or nil.

local button = UI:FindFirstChild("PlayButton")

button.Pressed:Connect(function()
	button.Text = "Loading..."
end)

CreateWindow

UI:CreateWindow(width: number, height: number, style: string?): Widget

Creates a translucent window docked to the left edge. With style set to "toolbar" it docks to the bottom edge.

local window = UI:CreateWindow(260, 180)
window:AddLabel("Shop", 18, true)

CreatePanel

UI:CreatePanel(options: table): Widget

Creates a freely positioned panel. X, Y, AnchorX and AnchorY are normalized screen coordinates from 0 to 1.

OptionDefaultDescription
X, Y0.5, 0.02Normalized screen position.
AnchorX, AnchorY0.5, 0Normalized anchor point within the panel.
Width, Height400, 140Size in pixels.
Padding10Inner padding in pixels.
local panel = UI:CreatePanel({ Y = 0.05, Width = 300, Height = 60 })
panel:AddLabel("Round 1", 20, true)

Remember

UI:Remember(name: string, text: string)

Persists a string on the local device, scoped to this game. Not visible to the server or other devices. Use DataStore for authoritative data.

Recall

UI:Recall(name: string): string?

Returns the string stored with Remember, or nil.

On this page