Open Asterune
UserInputType

UserInputType

Identifies the category of an input.

Access items through Enum.UserInputType.

Behavior

Enum.UserInputType identifies keyboard, pointer, touch, gamepad, and other input categories. Check it before reading device-specific InputObject fields.

Items

Items20Value

MouseButton1

The primary mouse button.

MouseButton2

The secondary mouse button.

MouseButton3

The middle mouse button.

MouseWheel

Mouse wheel scrolling. Scroll movement is reported in Position.

MouseMovement

Pointer motion. Read Delta for relative movement.

Touch

Touchscreen input. Each simultaneous touch has a separate InputObject.

Keyboard

Keyboard input. Read KeyCode to identify the key.

Focus

A window focus change. Clear held-input state on focus loss.

Accelerometer

Device acceleration input.

Gyro

Device rotation input.

Gamepad1

The first gamepad. Gamepad2 through Gamepad8 identify additional gamepads.

TextInput

Text input for a focused text field.

None

No input device category.

Example

Luau
local InputService = game:GetService("InputService")
InputService.Began:Connect(function(input)
  if input.UserInputType == Enum.UserInputType.Keyboard then
    print(input.KeyCode)
  end
end)

InputObject · InputService · Enum.KeyCode · Enum.UserInputState