Class · inherits Instance
InputAction
Defines a gameplay action mechanic. These actions are then mapped to hardware
inputs using InputBinding.
About InputAction
InputAction defines a gameplay action mechanic such as "Jump," "Sprint," or
"Shoot." These actions are then mapped to hardware inputs using
InputBinding. An InputAction will check for its first ancestor type
of InputContext and register itself to that context (if there is no
ancestor context, it will be registered to a default context).
Properties 4
DisplayName
: stringLocalized display name for this action.A custom string used to show a localized display name for this action in UI elements such as a controls help menu.
Enabled
: booleanDetermines if theInputActionis enabled or not.Determines if the
InputActionis enabled or not. The action state will be reset if this property is toggled tofalse.PreferredBinding
: InputBindingReadOnlyNotReplicatedTheInputBindingbest matching the player's current input device.A read-only reference to the
InputBindingchild that matches the player's current input device usingUserInputService.PreferredInput.Type
: InputActionTypeSpecifies what type of input value the action is expecting.Specifies what type of input value the action is expecting. See
InputActionTypefor more details.
Methods 1
GetState
() → VariantReturns the current state of theInputAction.Returns the current state of the
InputAction, for exampletruefor an action withTypeset toBool.
Events 3
Pressed
InputAction.Pressed:Connect(function())Fires only when theInputAction.Typeis set toBoolon a state transition fromfalsetotrue.Released
InputAction.Released:Connect(function())Fires only when theInputAction.Typeis set toBoolon a state transition fromtruetofalse.StateChanged
InputAction.StateChanged:Connect(function(value))Fires for allInputActionTypetypes whenever the state changes, except if the state attempts to transition to the same state.This event fires for all
InputActionTypetypes whenever the state changes, except if the state attempts to transition to the same state.
InputAction 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.