Roblox UtilitiesDevlHub Roblox Documentation

Class

InputActionLabel

Inherits
GuiObject › GuiBase2d › GuiBase › Instance › Object
Memory category
Gui

A GuiObject that automatically displays the keybinding for an action as text or an image.

InputActionLabel is a drag-and-drop GuiObject that automatically shows the appropriate key or icon for an InputAction based on the player's current input device (keyboard/mouse, gamepad, touch, VR). When the player switches devices or the binding is rebound, the label updates instantly without scripting.

Rendering of the InputActionLabel depends on the InputAction (linked through InputActionLabel.InputAction) and that action's child InputBindings. As the label resolves what to show, it follows this order:

  1. Custom Images — If child InputBindings have their DisplayImage property set, the label renders those images directly, optionally modified by ImageColor3 and ImageTransparency.

  2. Platform Key Images — Lacking custom images, the label renders platform-provided images for child InputBindings through UserInputService:GetImageForKeyCode(), if such images are available. Composite bindings with modifiers show multiple icons with + separators.

  3. Custom Names — Lacking available images, if child InputBindings have their DisplayName property set, the label renders that text in a style defined by FontFace, TextColor3, TextSize, TextTransparency, TextWrapped, TextXAlignment, and TextYAlignment.

  4. Platform Key Strings — Lacking all of the above, the label renders platform-provided strings through UserInputService:GetStringForKeyCode().

  5. If no InputAction is assigned or no child InputBinding exists, the label renders a placeholder icon.

Properties 12#

FontFaceDatatype.FontDetermines the font used to render text.ReadSafe
ImageColor3Color3Determines how rendered label images will be colorized.ReadSafe
ImageTransparencyfloatDetermines the transparency of rendered label images.ReadSafe
InputActionInputActionThe InputAction whose preferred binding this label displays.ReadSafe
ResolvedImageContentContentRead-only. The resolved image content currently being displayed.ReadSafeReadOnlyNotReplicated
ResolvedTextstringThe resolved key name string currently being displayed.ReadSafeReadOnlyNotReplicated
TextColor3Color3Determines the color of rendered text.ReadSafe
TextSizefloatDetermines the line height of text in offsets.ReadSafe
TextTransparencyfloatDetermines the transparency of rendered text.ReadSafe
TextWrappedbooleanDetermines if text wraps to multiple lines within the label's space.ReadSafe
TextXAlignmentTextXAlignmentDetermines the horizontal alignment of rendered text.ReadSafe
TextYAlignmentTextYAlignmentDetermines the vertical alignment of rendered text.ReadSafe

FontFace: Datatype.Font#

ReadSafe

This property is similar to TextLabel.FontFace and determines the font family, weight, and style used when the label renders in a text mode.

ImageColor3: Color3#

ReadSafe

This property determines how label images are colorized. When set to white, no colorization occurs. This property is useful for reusing image assets; if the source images are completely white with transparency, you can set the entire label color at once with this property.

ImageTransparency: float#

ReadSafe

This property determines the alpha of rendered label images. A value of 0 is completely opaque and a value of 1 is completely transparent (invisible).

InputAction: InputAction#

ReadSafe

The InputAction instance for which to have the label automatically resolve and display its preferred binding. When the binding changes (due to rebinding or input device switching), the label updates automatically.

Setting this to nil clears the display and shows the placeholder.

ResolvedImageContent: Content#

ReadOnlyNotReplicatedReadSafe

Contains the Content of the first resolved image when the label renders in an image mode. Empty when in text or placeholder mode. This is a read-only property set by the engine when the binding resolves.

ResolvedText: string#

ReadOnlyNotReplicatedReadSafe

Contains the composed key name string such as Ctrl + Shift + Space when the label renders in text mode. Empty when the label renders in image or placeholder mode. This is a read-only property set by the engine when the binding resolves.

TextColor3: Color3#

ReadSafe

This property determines the color of all text rendered by the label.

TextSize: float#

ReadSafe

Controls the font size in pixels for text mode rendering. Value is clamped between 1 and 200.

TextTransparency: float#

ReadSafe

This property determines the transparency of all text rendered by the label.

TextWrapped: boolean#

ReadSafe

When true, text renders on multiple lines within the label's space so that TextSize lines never exceed the GuiBase2d.AbsoluteSize of the object. This is achieved by breaking long lines of text into multiple lines.

TextXAlignment: TextXAlignment#

ReadSafe

This property determines the horizontal alignment of text rendered within the label's space.

TextYAlignment: TextYAlignment#

ReadSafe

This property determines the vertical alignment of text rendered within the label's space.

Inherited members#

Inherited from GuiObject 51
Inherited from GuiBase2d 12
Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed