Class · inherits Instance
InputBinding
Defines which hardware binding should trigger the parent InputAction.
About InputBinding
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.
Properties 22
Backward
: KeyCodeSpecifies an alternateKeyCodefor dispatching directionally "backward" inputs to the parentInputAction.Specifies an alternate
KeyCodefor dispatching directionally "backward" inputs toGetState()and theStateChangedevent of the parentInputAction. Only applies when the parent action'sTypeisDirection3D, in which case the dispatched value will be aVector3with itsZcomponent between0and1.ClampMagnitudeToOne
: booleanSpecifies how the binding normalizes composite directional input to a maximum magnitude of1.Determines whether the binding normalizes the combined composite directional vector to a maximum magnitude of
1only if it exceeds that length. This prevents diagonal composite inputs (for exampleUpandRightpressed simultaneously) from producing a magnitude greater than1, ensuring consistent movement speed regardless of the keys held. Default istrue.This property only applies when the parent action's
TypeisDirection1D,Direction2D, orDirection3D.Set this to
falsewhen input axes should remain independent of one another, such as 3D freecam movement, or when combining inputs whose raw values can exceed1(for example mouse wheel velocity) and you want to handle scaling yourself.DisplayImage
: ContentCustom image asset to display for this binding.A custom
Contentimage 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.GetImageForKeyCodeto obtain a platform-appropriate image. Use this together withInputAction.PreferredBindingto build keybinding UI that automatically reflects the player's active input device without manually resolving which binding image to display.DisplayName
: stringCustom display text for this binding.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.GetStringForKeyCodeto obtain the platform-appropriate key name. Use this together withInputAction.PreferredBindingto build keybinding UI that automatically reflects the player's active input device without manually resolving which binding name to display.Down
: KeyCodeSpecifies an alternateKeyCodefor dispatching directionally "down" inputs to the parentInputAction.Specifies an alternate
KeyCodefor dispatching directionally "down" inputs toGetState()and theStateChangedevent of the parentInputAction.When the parent action's
TypeisDirection1D, the dispatched value will be a number between0and-1.When the parent action's
TypeisDirection2D, the dispatched value will be aVector2with itsYcomponent between0and-1.When the parent action's
TypeisDirection3D, the dispatched value will be aVector3with itsYcomponent between0and-1.Forward
: KeyCodeSpecifies an alternateKeyCodefor dispatching directionally "forward" inputs to the parentInputAction.Specifies an alternate
KeyCodefor dispatching directionally "forward" inputs toGetState()and theStateChangedevent of the parentInputAction. Only applies when the parent action'sTypeisDirection3D, in which case the dispatched value will be aVector3with itsZcomponent between0and-1.KeyCode
: KeyCodeSpecifies theKeyCodewhich triggers the parentInputAction.Specifies the
KeyCodewhich triggers the parentInputAction. The code type should match the input action'sType, for exampleKeyCode.Efor an action type ofBoolorKeyCode.Thumbstick1for an action type ofDirection2D. Type mismatches will either not fire theInputActionor theStateChangedevent will receive a converted value.Left
: KeyCodeSpecifies an alternateKeyCodefor dispatching directionally "left" inputs to the parentInputAction.Specifies an alternate
KeyCodefor dispatching directionally "left" inputs toGetState()and theStateChangedevent of the parentInputAction.When the parent action's
TypeisDirection2D, the dispatched value will be aVector2with itsXcomponent between0and-1.When the parent action's
TypeisDirection3D, the dispatched value will be aVector3with itsXcomponent between0and-1.Not applicable when the parent action's
TypeisDirection1DorBool.PointerIndex
: intPressedThreshold
: floatNumerical value above which to fire anInputActionwith aTypeofBool.Numerical value above which to fire an
InputActionwith aTypeofBool, for example when a gamepad trigger such asKeyCode.ButtonL2exceeds0.5(halfway pressed). Default is0.5.This property must be greater than or equal to
ReleasedThresholdor else it will be clamped toReleasedThreshold.PrimaryModifier
: KeyCodeSpecifies a primaryKeyCodethat must be pressed for the binding to activate.Specifies a
KeyCodethat serves as a required modifier for the binding. TheInputBindingwill only trigger the parentInputActionif this input is pressed prior toKeyCode,UIButton, or composite directions.There is no ordering requirement between
PrimaryModifierandSecondaryModifier. 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.ReleasedThreshold
: floatNumerical value below which to fire anInputActionwith aTypeofBool.Numerical value below which to fire an
InputActionwith aTypeofBool, for example when a gamepad trigger such asKeyCode.ButtonL2falls below0.5(less than halfway pressed). Default is0.2.This property must be less than or equal to
PressedThresholdor else it will be clamped toPressedThreshold.ResponseCurve
: floatNumerical value to configure scaling for more precise thumbstick aiming.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
1to10, with higher values providing a more intense curve. Default is1, at which input is returned exactly as received.Only applicable when the parent action's
TypeisDirection2Dand theKeyCodeisThumbstick1orThumbstick2.Right
: KeyCodeSpecifies an alternateKeyCodefor dispatching directionally "right" inputs to the parentInputAction.Specifies an alternate
KeyCodefor dispatching directionally "right" inputs toGetState()and theStateChangedevent of the parentInputAction.When the parent action's
TypeisDirection2D, the dispatched value will be aVector2with itsXcomponent between0and1.When the parent action's
TypeisDirection3D, the dispatched value will be aVector3with itsXcomponent between0and1.Not applicable when the parent action's
TypeisDirection1DorBool.Scale
: floatScalar multiplier applied uniformly to all components of a directionalInputAction's output.A scalar multiplier applied uniformly to every component of the output value. Applies to
InputActiontypesDirection1D,Direction2D, andDirection3D.To scale individual components independently, use
Vector2Scale(forDirection2D) orVector3Scale(forDirection3D). When bothScaleand a vector scale are set, both are applied.SecondaryModifier
: KeyCodeSpecifies a secondaryKeyCodethat must be pressed for the binding to activate.Specifies a
KeyCodethat serves as a required modifier for the binding. TheInputBindingwill only trigger the parentInputActionif this input is pressed prior toKeyCode,UIButton, or composite directions.There is no ordering requirement between
PrimaryModifierandSecondaryModifier. 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.Type
: InputBindingTypeDetermines whether this binding is triggered by hardware input or programmatically viaFire().Determines whether this
InputBindingis triggered by hardware input (Automatic) or programmatically viaFire()(Scriptable).When set to
Automatic(default), the binding responds to physical input devices (keyboard, mouse, gamepad, touch) based on itsKeyCodeor composite direction or UI button properties.When set to
Scriptable, the binding ignores hardware input and instead receives state updates exclusively through theFire()method.UIModifier
: GuiButtonSpecifies aGuiButtonthat must be active for the binding to activate.Specifies a
GuiButtonthat must be pressed for theInputBindingto trigger the parentInputAction. Behaves similarly toPrimaryModifierandSecondaryModifier, but accepts a UI button reference rather than aKeyCode.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.Up
: KeyCodeSpecifies an alternateKeyCodefor dispatching directionally "up" inputs to the parentInputAction.Specifies an alternate
KeyCodefor dispatching directionally "up" inputs toGetState()and theStateChangedevent of the parentInputAction.When the parent action's
TypeisDirection1D, the dispatched value will be a number between0and1.When the parent action's
TypeisDirection2D, the dispatched value will be aVector2with itsYcomponent between0and1.When the parent action's
TypeisDirection3D, the dispatched value will be aVector3with itsYcomponent between0and1.Vector2Scale
: Vector2Per-component scale applied to the output of aDirection2Daction.Amount by which each component of the output is independently linearly scaled. Only applies when the parent action's
TypeisDirection2D.Vector3Scale
: Vector3Per-component scale applied to the output of aDirection3Daction.Amount by which each component of the output is independently linearly scaled. Only applies when the parent action's
TypeisDirection3D.
Methods 1
Fire
(state: Variant) → ()Programmatically updates the parentInputActionstate through this binding.Programmatically updates the parent
InputActionto the given state and fires the appropriate signals (Pressed,Released,StateChanged).This method can only be called on bindings with
Typeset toScriptable. Calling it on anAutomaticbinding will throw an error.The
stateparameter must match theTypeof the parentInputAction:Boolexpects abooleanDirection1Dexpects anumberDirection2Dexpects aVector2Direction3Dexpects aVector3ViewportPositionexpects aVector2
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
InputActionmust beEnabledand its ancestorInputContextmust also beEnabled, otherwise the call is silently ignored.
InputBinding also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.