Class
InputActionLabel
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:
Custom Images — If child
InputBindingshave theirDisplayImageproperty set, the label renders those images directly, optionally modified byImageColor3andImageTransparency.Platform Key Images — Lacking custom images, the label renders platform-provided images for child
InputBindingsthroughUserInputService:GetImageForKeyCode(), if such images are available. Composite bindings with modifiers show multiple icons with+separators.Custom Names — Lacking available images, if child
InputBindingshave theirDisplayNameproperty set, the label renders that text in a style defined byFontFace,TextColor3,TextSize,TextTransparency,TextWrapped,TextXAlignment, andTextYAlignment.Platform Key Strings — Lacking all of the above, the label renders platform-provided strings through
UserInputService:GetStringForKeyCode().If no
InputActionis assigned or no childInputBindingexists, the label renders a placeholder icon.
Properties 12#
FontFaceDatatype.Font | Determines the font used to render text.ReadSafe |
ImageColor3Color3 | Determines how rendered label images will be colorized.ReadSafe |
ImageTransparencyfloat | Determines the transparency of rendered label images.ReadSafe |
InputActionInputAction | The InputAction whose preferred binding this label displays.ReadSafe |
ResolvedImageContentContent | Read-only. The resolved image content currently being displayed.ReadSafeReadOnlyNotReplicated |
ResolvedTextstring | The resolved key name string currently being displayed.ReadSafeReadOnlyNotReplicated |
TextColor3Color3 | Determines the color of rendered text.ReadSafe |
TextSizefloat | Determines the line height of text in offsets.ReadSafe |
TextTransparencyfloat | Determines the transparency of rendered text.ReadSafe |
TextWrappedboolean | Determines if text wraps to multiple lines within the label's space.ReadSafe |
TextXAlignmentTextXAlignment | Determines the horizontal alignment of rendered text.ReadSafe |
TextYAlignmentTextYAlignment | Determines 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
Properties (30)
Active, AnchorPoint, AutomaticSize, BackgroundColor, BackgroundColor3, BackgroundTransparency, BorderColor, BorderColor3, BorderMode, BorderSizePixel, ClipsDescendants, Draggable, GuiState, InputSink, Interactable, LayoutOrder, NextSelectionDown, NextSelectionLeft, NextSelectionRight, NextSelectionUp, Position, Rotation, Selectable, SelectionImageObject, SelectionOrder, Size, SizeConstraint, Transparency, Visible, ZIndex
Methods (3)
Inherited from GuiBase2d 12
Properties (11)
AbsolutePosition, AbsoluteRotation, AbsoluteSize, AutoLocalize, Localize, RootLocalizationTable, SelectionBehaviorDown, SelectionBehaviorLeft, SelectionBehaviorRight, SelectionBehaviorUp, SelectionGroup
Events (1)
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild