# InputAction

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/InputAction/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/InputAction

Defines a gameplay action mechanic. These actions are then mapped to hardware inputs using [`InputBinding`](https://rapi.sleaze.dev/classes/InputBinding.md).

## Properties

### Enabled

```luau
InputAction.Enabled: boolean = true
```

- Tags: Read capabilities: Input, Simulation access

Determines if the [`InputAction`](https://rapi.sleaze.dev/classes/InputAction.md) is enabled or not.

### Type

```luau
InputAction.Type: Enum.InputActionType = Enum.InputActionType.Bool
```

- Tags: Read capabilities: Input, Simulation access

Specifies what type of input value the action is expecting.

### BoolState

```luau
InputAction.BoolState: boolean = false
```

- Tags: Not scriptable, Read only, Roblox script security, Read capabilities: Input

Non-scriptable read-only property useful for debugging `Bool` input actions.

### Direction1DState

```luau
InputAction.Direction1DState: number = 0
```

- Tags: Not scriptable, Read only, Roblox script security, Read capabilities: Input

Non-scriptable read-only property useful for debugging `Direction1D` input actions.

### Direction2DState

```luau
InputAction.Direction2DState: Vector2 = Vector2.zero
```

- Tags: Not scriptable, Read only, Roblox script security, Read capabilities: Input

Non-scriptable read-only property useful for debugging `Direction2D` input actions.

### Direction3DState

```luau
InputAction.Direction3DState: Vector3 = Vector3.zero
```

- Tags: Not scriptable, Read only, Roblox script security, Read capabilities: Input

Non-scriptable read-only property useful for debugging `Direction3D` input actions.

### PreferredBinding

```luau
InputAction.PreferredBinding: InputBinding
```

- Tags: Read only, Capabilities: Input, Save only

The [`InputBinding`](https://rapi.sleaze.dev/classes/InputBinding.md) best matching the player's current input device.

### ViewportPositionState

```luau
InputAction.ViewportPositionState: Vector2 = Vector2.zero
```

- Tags: Not scriptable, Read only, Roblox script security, Read capabilities: Input

Non-scriptable read-only property useful for debugging `ViewportPosition` input actions.

### DisplayName

```luau
InputAction.DisplayName: string = ""
```

- Tags: Capabilities: Input, Simulation access

Localized display name for this action.

### Editor

```luau
InputAction.Editor: boolean = false
```

- Tags: Not replicated, Not scriptable, Roblox script security, Read capabilities: Input

## Methods

### GetInputBindings

```luau
InputAction:GetInputBindings(): { Instance }
```

- Tags: Roblox script security, Capabilities: Input

### GetPreferredBindingList

```luau
InputAction:GetPreferredBindingList(count: number? = 0): { Instance }
```

- Tags: Roblox script security, Capabilities: Input

### GetState

```luau
InputAction:GetState(): any
```

- Tags: Thread safe, Capabilities: Input, Simulation access

Returns the current state of the [`InputAction`](https://rapi.sleaze.dev/classes/InputAction.md).

Returns: The current state of [`InputAction`](https://rapi.sleaze.dev/classes/InputAction.md).

### Fire

```luau
InputAction:Fire(state: any)
```

- Tags: Deprecated, Capabilities: Input, Simulation access
- Use instead: [`InputAction.Fire`](https://rapi.sleaze.dev/classes/InputAction.md)

**Deprecated:** Use [`InputBinding:Fire()`](https://rapi.sleaze.dev/classes/InputBinding.md) with a `Scriptable` binding instead.

Updates the [`InputAction`](https://rapi.sleaze.dev/classes/InputAction.md) to the given state and fires the appropriate signals.

## Events

### InputBindingsChanged

```luau
InputAction.InputBindingsChanged: RBXScriptSignal<()>
```

- Tags: Roblox script security, Capabilities: Input

### Pressed

```luau
InputAction.Pressed: RBXScriptSignal<()>
```

- Tags: Capabilities: Input

Fires only when the [`InputAction.Type`](https://rapi.sleaze.dev/classes/InputAction.md) is set to `Bool` on a state transition from `false` to `true`.

### Released

```luau
InputAction.Released: RBXScriptSignal<()>
```

- Tags: Capabilities: Input

Fires only when the [`InputAction.Type`](https://rapi.sleaze.dev/classes/InputAction.md) is set to `Bool` on a state transition from `true` to `false`.

### StateChanged

```luau
InputAction.StateChanged: RBXScriptSignal<(value: any)>
```

- Tags: Capabilities: Input

Fires for all `InputActionType` types whenever the state changes, except if the state attempts to transition to the same state.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
