Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
InputBinding
Inherits from: Instance ā Object
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.
Inherits from: Instance
Memory category: Instances
Properties
| Name | Type / Returns | Description |
|---|---|---|
| InputBinding.Backward | KeyCode | Specifies an alternate KeyCode for dispatching directionally "backward" inputs to the parent InputAction. |
| InputBinding.ClampMagnitudeToOne | boolean | Specifies how the binding normalizes composite directional input to a maximum magnitude of 1. |
| InputBinding.DisplayImage | Content | Custom image asset to display for this binding. |
| InputBinding.DisplayName | string | Custom display text for this binding. |
| InputBinding.Down | KeyCode | Specifies an alternate KeyCode for dispatching directionally "down" inputs to the parent InputAction. |
| InputBinding.Forward | KeyCode | Specifies an alternate KeyCode for dispatching directionally "forward" inputs to the parent InputAction. |
| InputBinding.KeyCode | KeyCode | Specifies the KeyCode which triggers the parent InputAction. |
| InputBinding.Left | KeyCode | Specifies an alternate KeyCode for dispatching directionally "left" inputs to the parent InputAction. |
| InputBinding.PointerIndex | int | |
| InputBinding.PressedThreshold | float | Numerical value above which to fire an InputAction with a Type of Bool. |
| InputBinding.PrimaryModifier | KeyCode | Specifies a primary KeyCode that must be pressed for the binding to activate. |
| InputBinding.ReleasedThreshold | float | Numerical value below which to fire an InputAction with a Type of Bool. |
| InputBinding.ResponseCurve | float | Numerical value to configure scaling for more precise thumbstick aiming. |
| InputBinding.Right | KeyCode | Specifies an alternate KeyCode for dispatching directionally "right" inputs to the parent InputAction. |
| InputBinding.Scale | float | Scalar multiplier applied uniformly to all components of a directional InputAction's output. |
| InputBinding.SecondaryModifier | KeyCode | Specifies a secondary KeyCode that must be pressed for the binding to activate. |
| InputBinding.Type | InputBindingType | Determines whether this binding is triggered by hardware input or programmatically via Fire(). |
| InputBinding.UIButton | GuiButton | Connects a GuiButton to a boolean action. |
| InputBinding.UIModifier | GuiButton | Specifies a GuiButton that must be active for the binding to activate. |
| InputBinding.Up | KeyCode | Specifies an alternate KeyCode for dispatching directionally "up" inputs to the parent InputAction. |
| InputBinding.Vector2Scale | Vector2 | Per-component scale applied to the output of a Direction2D action. |
| InputBinding.Vector3Scale | Vector3 | Per-component scale applied to the output of a Direction3D action. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.Archivable | boolean | Determines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published. |
| Instance.archivable | boolean | |
| Instance.Capabilities | SecurityCapabilities | The set of capabilities allowed to be used for scripts inside this container. |
| Instance.IsInSandbox | boolean | Indicates whether the instance is inside a sandboxed container. |
| Instance.Name | string | A non-unique identifier of the Instance. |
| Instance.Parent | Instance | Determines the hierarchical parent of the Instance. |
| Instance.PredictionMode | PredictionMode | Reflects the client-side prediction mode applied to the instance under server-authoritative physics. |
| Instance.RobloxLocked | boolean | A deprecated property that used to protect CoreGui objects. |
| Instance.Sandboxed | boolean | When enabled, the instance can only access abilities in its Capabilities list. |
| Instance.UniqueId | UniqueId | A unique identifier for the instance. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.ClassName | string | A read-only string representing the class this Object belongs to. |
| Object.className | string |
InputBinding.Backward
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.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Composite Directions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.ClampMagnitudeToOne
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.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Composite Directions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.DisplayImage
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.
| Field | Value |
|---|---|
| type | Content |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Display |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.DisplayName
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.
| Field | Value |
|---|---|
| type | string |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Display |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.Down
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.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Composite Directions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.Forward
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.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Composite Directions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.KeyCode
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.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.Left
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.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Composite Directions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.PointerIndex
| Field | Value |
|---|---|
| type | int |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.PressedThreshold
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.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.PrimaryModifier
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.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.ReleasedThreshold
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.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.ResponseCurve
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.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.Right
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.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Composite Directions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.Scale
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.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.SecondaryModifier
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.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.Type
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.
| Field | Value |
|---|---|
| type | InputBindingType |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.UIButton
GuiButton to connect to a boolean action.
| Field | Value |
|---|---|
| type | GuiButton |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.UIModifier
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.
| Field | Value |
|---|---|
| type | GuiButton |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.Up
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.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Composite Directions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.Vector2Scale
Amount by which each component of the output is independently linearly scaled. Only applies when the parent action's Type is Direction2D.
| Field | Value |
|---|---|
| type | Vector2 |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
InputBinding.Vector3Scale
Amount by which each component of the output is independently linearly scaled. Only applies when the parent action's Type is Direction3D.
| Field | Value |
|---|---|
| type | Vector3 |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Input"] |
Methods
| Name | Type / Returns | Description |
|---|---|---|
| InputBinding:Fire | () | Programmatically updates the parent InputAction state through this binding. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance:AddTag | () | Applies a tag to the instance. |
| Instance:children | Instances | Returns an array of the object's children. |
| Instance:ClearAllChildren | () | This method destroys all of an instance's children. |
| Instance:Clone | Instance | Create a copy of an instance and all its descendants, ignoring instances that are not Archivable. |
| Instance:clone | Instance | |
| Instance:Destroy | () | Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children. |
| Instance:destroy | () | |
| Instance:FindFirstAncestor | Instance? | Returns the first ancestor of the Instance whose Instance.Name is equal to the given name. |
| Instance:FindFirstAncestorOfClass | Instance? | Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className. |
| Instance:FindFirstAncestorWhichIsA | Instance? | Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstChild | Instance? | Returns the first child of the Instance found with the given name. |
| Instance:findFirstChild | Instance | |
| Instance:FindFirstChildOfClass | Instance? | Returns the first child of the Instance whose ClassName is equal to the given class name. |
| Instance:FindFirstChildWhichIsA | Instance? | Returns the first child of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstDescendant | Instance? | Returns the first descendant found with the given Instance.Name. |
| Instance:GetActor | Actor? | Returns the Actor associated with the Instance, if any. |
| Instance:GetAttribute | Variant | Returns the value which has been assigned to the given attribute name. |
| Instance:GetAttributeChangedSignal | RBXScriptSignal | Returns an event that fires when the given attribute changes. |
| Instance:GetAttributes | Dictionary | Returns a dictionary of the instance's attributes. |
| Instance:GetChildren | Instances | Returns an array containing all of the instance's children. |
| Instance:getChildren | Instances | |
| Instance:GetDebugId | string | Returns a coded string of the debug ID used internally by Roblox. |
| Instance:GetDescendants | Instances | Returns an array containing all of the descendants of the instance. |
| Instance:GetFullName | string | Returns a string describing the instance's ancestry. |
| Instance:GetStyled | Variant | Returns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified. |
| Instance:GetStyledPropertyChangedSignal | RBXScriptSignal | Returns an event that fires when the given style property changes on the instance. |
| Instance:GetTags | Array | Gets an array of all tags applied to the instance. |
| Instance:HasTag | boolean | Check whether the instance has a given tag. |
| Instance:IsAncestorOf | boolean | Returns true if an Instance is an ancestor of the given descendant. |
| Instance:IsDescendantOf | boolean | Returns true if an Instance is a descendant of the given ancestor. |
| Instance:isDescendantOf | boolean | |
| Instance:IsPropertyModified | boolean | Returns true if the value stored in the specified property is not equal to the code-instantiated default. |
| Instance:QueryDescendants | Instances | Returns an array containing all descendants of the instance that match the selector string. |
| Instance:Remove | () | Sets the object's Parent to nil, and does the same for all its descendants. |
| Instance:remove | () | |
| Instance:RemoveTag | () | Removes a tag from the instance. |
| Instance:ResetPropertyToDefault | () | Resets a property to its default value. |
| Instance:SetAttribute | () | Sets the attribute with the given name to the given value. |
| Instance:WaitForChild | Instance | Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object:GetPropertyChangedSignal | RBXScriptSignal | Get an event that fires when a given property of the object changes. |
| Object:IsA | boolean | Returns true if an object's class matches or inherits from a given class. |
| Object:isA | boolean |
InputBinding:Fire
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:
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 InputAction must be Enabled and its ancestor InputContext must also be Enabled, otherwise the call is silently ignored.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| state | Variant | The state value to apply; must match the parent action's Type. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["Input"] |
| simulationAccess | true |
Events
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.AncestryChanged | Fires when the Instance.Parent property of this object or one of its ancestors is changed. | |
| Instance.AttributeChanged | Fires whenever an attribute is changed on the Instance. | |
| Instance.ChildAdded | Fires after an object is parented to this Instance. | |
| Instance.childAdded | ||
| Instance.ChildRemoved | Fires after a child is removed from this Instance. | |
| Instance.DescendantAdded | Fires after a descendant is added to the Instance. | |
| Instance.DescendantRemoving | Fires immediately before a descendant of the Instance is removed. | |
| Instance.Destroying | Fires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy(). | |
| Instance.StyledPropertiesChanged | Fires whenever any style property is changed on the instance, including when a property is set to nil. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.Changed | Fires immediately after a property of the object changes, with some limitations. |