UI
Types
Dict type
type Dict<T> = { [T]: any }Symbol type
type Symbol = { type: "Symbol" }Platform type
type Platform = "Console" | "Mobile" | "PC" | "VR"ActiveStateType type
type ActiveStateType = "hover" | "floating" | "dialog"TextRequest type
type TextRequest = { Text: string, Font: Font, Size: number, RichText: boolean? }Properties
Class
UI.ClassSound
UI.SoundHaptic
UI.HapticGuiService
UI.GuiService: GuiServiceTextService
UI.TextService: TextServiceUserInputService
UI.UserInputService: UserInputServiceLocalPlayer
UI.LocalPlayerPlayerGui
UI.PlayerGuiTouch
UI.TouchIsConsoleScreen
UI.IsConsoleScreen: booleanPlatform
UI.Platform: PlatformHook
UI.Hook: SymbolA marker for defining UI state hooks in UI.edit
Function
UI.Function: SymbolA marker for defining function defaultState in UI.makeStatefulDefaults
Nil
UI.Nil: SymbolA marker for defining Nil defaultState in UI.makeStatefulDefaults
TopbarInset
UI.TopbarInsetGuiService.TopbarInset as a Flux state
TopbarPadding
UI.TopbarPadding: anyLayerBottom
UI.LayerBottomThe lowermost ScreenGui for UI components
LayerDefault
UI.LayerDefaultThe default ScreenGui for UI components
LayerTop
UI.LayerTopThe topmost ScreenGui for UI components
LayerTopInset
UI.LayerTopInsetLayerTopbar
UI.LayerTopbarThe Topbar ScreenGui for UI components
TopbarFrame
UI.TopbarFrameA sorted Topbar Frame for UI components, parented under UI.LayerTopbar
Fonts Module
UI.Fonts: FontsTheme Module
UI.Theme: ThemeThemes from Theme
UI.Themes: {}Functions
getFontName
flush
UI.flush()Flushes pending reactive updates unless inside a UI.batch.
batch
UI.batch<T>(fn: () -> T): TDefers intermediate Flux.flush() calls from UI.new/UI.edit until fn finishes. Do not yield inside fn.
activateState
UI.activateState(activeState: any, stateType: ActiveStateType)A generalized function to handle activation/deactivation of both floating and hover states
deactivateState
UI.deactivateState(activeState: any, stateType: ActiveStateType)A generalized function to deactivate both floating and hover states
toggleState
UI.toggleState(activeState: any, stateType: ActiveStateType)A generalized function to toggle both floating and hover states
clearState
UI.clearState(stateType: ActiveStateType)Function to clear a specific state type
clearActiveStates
UI.clearActiveStates()Function to clear all active state types
invertLuminance
Inverts the luminance of a Color3 by an amount
retryGetTextBoundsAsync Yields
UI.retryGetTextBoundsAsync(params): Vector2textWidth
UI.textWidth(getRequests: () -> { TextRequest }): (Flux.Node<number>, Flux.Node<any>)Measures the widest of getRequests() without yielding inside the reactive graph. getRequests runs in an effect (its reads are tracked); the returned signal starts at an estimate and settles to the measured width once TextService:GetTextBoundsAsync resolves on a deferred thread. Stale measurements are dropped. Never call UI.retryGetTextBoundsAsync inside a computed, effect, or reactive property: it yields mid-flush, which stalls Flux and corrupts dependency tracking for every other thread. Returns the width signal and the measuring effect; dispose both with the owning component.
makeStatefulDefaults
Helper function for defining Flux state defaults
newSinkHoverState
UI.newSinkHoverState(object: GuiObject, hovering: any?, options: Flux.HoverOptions?)edit
Inherits Flux.edit
- Parents children to the ._content variable of a UI component if one exists
- Unwraps UI component children and auto-numbers [GuiObject.LayoutOrder] sequentially via
Flux.edit - Allows UI.Hook to easily hook to default UI state or
RBXScriptSignalaliases
new
UI.new(className: string)Creates a new Instance with UI.edit
notifyDisplayWatchers
UI.notifyDisplayWatchers()Re-evaluates all deferred UI display watchers after an ancestor visibility change.
onFirstDisplayed
UI.onFirstDisplayed(inst: GuiObject, buildFn: () -> ())Runs buildFn once when inst and all its GuiObject ancestors are first displayed.
register
UI.register(className: string, class: Dict<any>)Registers a new UI component class
registerClasses
UI.registerClasses(): typeof(UI)Run to register the default classes for the UI module (classes load lazily on demand via UI.Class.__index)
fromHex from Color
Parses a hex string into a Color3, returning fallback (default white) when nil or invalid.
getLuminance from Motion
UI.getLuminance(c: Color3): numberGets the luminance of a Color3
pointInGuiObject from Interact
UI.pointInGuiObject(x: number, y: number, object: GuiObject): booleanChecks if x, y is within the absolute bounds of the GuiObject
sinkInput from Interact
UI.sinkInput(x: number, y: number, object: GuiObject, token: any?): booleanReturns true when input at (x, y) would be claimed by an Active or input-sinking GUI rendered above object (or while the Roblox escape menu is open). Pass the InputObject as token to share the hit-test query across multiple controls on the same input event.