Reference API Roblox

Engine API

Website

Related

Reference API Roblox

InputBinding

Defines which hardware binding should trigger the parent InputAction.

Member index 23

HistoryMember
731Backward: KeyCode
731ClampMagnitudeToOne: bool
731DisplayImage: Content
731DisplayName: string
731Down: KeyCode
731Forward: KeyCode
731KeyCode: KeyCode
731Left: KeyCode
731PointerIndex: int
731PressedThreshold: float
731PrimaryModifier: KeyCode
731ReleasedThreshold: float
731ResponseCurve: float
731Right: KeyCode
731Scale: float
731SecondaryModifier: KeyCode
731Type: InputBindingType
731UIButton: GuiButton
731UIModifier: GuiButton
731Up: KeyCode
731Vector2Scale: Vector2
731Vector3Scale: Vector3
727Fire(state: Variant): null
inherited from Instance
731Archivable: bool
731Capabilities: SecurityCapabilities
731IsInSandbox: bool
731Name: string
731Parent: Instance
731PredictionMode: PredictionMode
731Sandboxed: bool
731UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
731children(): Instances
731clone(): Instance
731destroy(): null
731findFirstChild(name: string, recursive: bool = false): Instance
731getChildren(): Instances
731isDescendantOf(ancestor: Instance): bool
731remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
731childAdded(child: Instance)
inherited from Object
731ClassName: string
731className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
731isA(className: string): bool
647Changed(property: string)

Description

An InputBinding defines which hardware binding should trigger the parent InputAction, for example a key press, gamepad button, or tap on a touch‑enabled device. There can be multiple InputBinding instances parented to an InputAction.

History 69

Members 23

Backward

TypeDefault
KeyCodeNone

Specifies an alternate KeyCode for dispatching directionally "backward" inputs to GetState() and the StateChanged event of the parent InputAction. Only applies when the parent action's Type is Direction3D, in which case the dispatched value will be a Vector3 with its Z component between 0 and 1.

History 3

ClampMagnitudeToOne

TypeDefault
booltrue

Determines whether the binding normalizes the combined composite directional vector to a maximum magnitude of 1 only if it exceeds that length. This prevents diagonal composite inputs (for example Up and Right pressed simultaneously) from producing a magnitude greater than 1, ensuring consistent movement speed regardless of the keys held. Default is true.

This property only applies when the parent action's Type is Direction1D, Direction2D, or Direction3D.

Set this to false when input axes should remain independent of one another, such as 3D freecam movement, or when combining inputs whose raw values can exceed 1 (for example mouse wheel velocity) and you want to handle scaling yourself.

History 3

DisplayImage

TypeDefault
Content

A custom Content image asset that represents this binding visually (for example a gamepad button image or a stylized key graphic).

When empty (the default), no custom image is provided. Developers can use UserInputService:GetImageForKeyCode() to obtain a platform-appropriate image. Use this together with InputAction.PreferredBinding to build keybinding UI that automatically reflects the player's active input device without manually resolving which binding image to display.

History 1

DisplayName

TypeDefault
string

A custom string that overrides the display name shown for this binding in UI elements such as key prompts (for example "FIGHT" instead of the default key name "F").

When empty (the default), no custom name is provided. Developers can use UserInputService:GetStringForKeyCode() to obtain the platform-appropriate key name. Use this together with InputAction.PreferredBinding to build keybinding UI that automatically reflects the player's active input device without manually resolving which binding name to display.

History 1

Down

TypeDefault
KeyCodeNone

Specifies an alternate KeyCode for dispatching directionally "down" inputs to GetState() and the StateChanged event of the parent InputAction.

When the parent action's Type is Direction1D, the dispatched value will be a number between 0 and -1.

When the parent action's Type is Direction2D, the dispatched value will be a Vector2 with its Y component between 0 and -1.

When the parent action's Type is Direction3D, the dispatched value will be a Vector3 with its Y component between 0 and -1.

Not applicable when the parent action's Type is Bool.

History 3

Fire

Parameters (1)
stateVariant
Returns (1)
null

Programmatically updates the parent InputAction to the given state and fires the appropriate signals (Pressed, Released, StateChanged).

This method can only be called on bindings with Type set to Scriptable. Calling it on an Automatic binding will throw an error.

The state parameter must match the Type of the parent InputAction:

Passing a mismatched type will cause an error. This method respects the same deduplication rules as hardware input, as in consecutive calls with the same state value will not re‑fire events.

The parent InputAction must be Enabled and its ancestor InputContext must also be Enabled, otherwise the call is silently ignored.

History 1

Forward

TypeDefault
KeyCodeNone

Specifies an alternate KeyCode for dispatching directionally "forward" inputs to GetState() and the StateChanged event of the parent InputAction. Only applies when the parent action's Type is Direction3D, in which case the dispatched value will be a Vector3 with its Z component between 0 and -1.

History 3

KeyCode

TypeDefault
KeyCodeNone

Specifies the KeyCode which triggers the parent InputAction. The code type should match the input action's Type, for example KeyCode.E for an action type of Bool or KeyCode.Thumbstick1 for an action type of Direction2D. Type mismatches will either not fire the InputAction or the StateChanged event will receive a converted value.

History 4

Left

TypeDefault
KeyCodeNone

Specifies an alternate KeyCode for dispatching directionally "left" inputs to GetState() and the StateChanged event of the parent InputAction.

When the parent action's Type is Direction2D, the dispatched value will be a Vector2 with its X component between 0 and -1.

When the parent action's Type is Direction3D, the dispatched value will be a Vector3 with its X component between 0 and -1.

Not applicable when the parent action's Type is Direction1D or Bool.

History 3

PointerIndex

TypeDefault
int0

History 5

PressedThreshold

TypeDefault
float0.5

Numerical value above which to fire an InputAction with a Type of Bool, for example when a gamepad trigger such as KeyCode.ButtonL2 exceeds 0.5 (halfway pressed). Default is 0.5.

This property must be greater than or equal to ReleasedThreshold or else it will be clamped to ReleasedThreshold.

History 3

PrimaryModifier

TypeDefault
KeyCodeNone

Specifies a KeyCode that serves as a required modifier for the binding. The InputBinding will only trigger the parent InputAction if this input is pressed prior to KeyCode, UIButton, or composite directions.

There is no ordering requirement between PrimaryModifier and SecondaryModifier. If both properties are set, both modifiers must be pressed to activate the binding, but the order in which they are pressed does not matter.

If set to KeyCode.Unknown, no primary modifier is required.

History 3

ReleasedThreshold

TypeDefault
float0.200000003

Numerical value below which to fire an InputAction with a Type of Bool, for example when a gamepad trigger such as KeyCode.ButtonL2 falls below 0.5 (less than halfway pressed). Default is 0.2.

This property must be less than or equal to PressedThreshold or else it will be clamped to PressedThreshold.

History 3

ResponseCurve

TypeDefault
float1

A numerical value to control the sensitivity of gamepad thumbstick input by applying a quadratic response curve. Commonly used for camera control to make small thumbstick inputs more precise, while ramping up quickly to allow for large movements with higher magnitude input.

Ranges between 1 to 10, with higher values providing a more intense curve. Default is 1, at which input is returned exactly as received.

Only applicable when the parent action's Type is Direction2D and the KeyCode is Thumbstick1 or Thumbstick2.

History 3

Right

TypeDefault
KeyCodeNone

Specifies an alternate KeyCode for dispatching directionally "right" inputs to GetState() and the StateChanged event of the parent InputAction.

When the parent action's Type is Direction2D, the dispatched value will be a Vector2 with its X component between 0 and 1.

When the parent action's Type is Direction3D, the dispatched value will be a Vector3 with its X component between 0 and 1.

Not applicable when the parent action's Type is Direction1D or Bool.

History 3

Scale

TypeDefault
float1

A scalar multiplier applied uniformly to every component of the output value. Applies to InputAction types Direction1D, Direction2D, and Direction3D.

To scale individual components independently, use Vector2Scale (for Direction2D) or Vector3Scale (for Direction3D). When both Scale and a vector scale are set, both are applied.

History 4

SecondaryModifier

TypeDefault
KeyCodeNone

Specifies a KeyCode that serves as a required modifier for the binding. The InputBinding will only trigger the parent InputAction if this input is pressed prior to KeyCode, UIButton, or composite directions.

There is no ordering requirement between PrimaryModifier and SecondaryModifier. If both properties are set, both modifiers must be pressed to activate the binding, but the order in which they are pressed does not matter.

If set to KeyCode.Unknown, no secondary modifier is required.

History 3

Type

TypeDefault
InputBindingTypeAutomatic

Determines whether this InputBinding is triggered by hardware input (Automatic) or programmatically via Fire() (Scriptable).

When set to Automatic (default), the binding responds to physical input devices (keyboard, mouse, gamepad, touch) based on its KeyCode or composite direction or UI button properties.

When set to Scriptable, the binding ignores hardware input and instead receives state updates exclusively through the Fire() method.

History 2

UIButton

TypeDefault
GuiButton

GuiButton to connect to a boolean action.

History 4

UIModifier

TypeDefault
GuiButton

Specifies a GuiButton that must be pressed for the InputBinding to trigger the parent InputAction. Behaves similarly to PrimaryModifier and SecondaryModifier, but accepts a UI button reference rather than a KeyCode.

This is particularly useful for touch input where the relevant interaction is defined by where on screen the touch originates, for example a dynamic thumbstick that should only respond to touches that begin within a specific UI region.

If nil, no modifier is required.

History 3

Up

TypeDefault
KeyCodeNone

Specifies an alternate KeyCode for dispatching directionally "up" inputs to GetState() and the StateChanged event of the parent InputAction.

When the parent action's Type is Direction1D, the dispatched value will be a number between 0 and 1.

When the parent action's Type is Direction2D, the dispatched value will be a Vector2 with its Y component between 0 and 1.

When the parent action's Type is Direction3D, the dispatched value will be a Vector3 with its Y component between 0 and 1.

Not applicable when the parent action's Type is Bool.

History 3

Vector2Scale

TypeDefault
Vector21, 1

Amount by which each component of the output is independently linearly scaled. Only applies when the parent action's Type is Direction2D.

History 3

Vector3Scale

TypeDefault
Vector31, 1, 1

Amount by which each component of the output is independently linearly scaled. Only applies when the parent action's Type is Direction3D.

History 3

Settings