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
The primary mouse button.
The secondary mouse button.
The middle mouse button.
Mouse wheel scrolling.
Pointer motion.
Touchscreen input.
Keyboard input.
A window focus change.
Device acceleration input.
Device rotation input.
The first gamepad.
Text input for a focused text field.
No input device category.
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
local InputService = game:GetService("InputService")
InputService.Began:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
print(input.KeyCode)
end
end)Related APIs
InputObject · InputService · Enum.KeyCode · Enum.UserInputState