Open Asterune
InputObject

InputObject

Describes an input type, state, position, and change.

Behavior

InputObject describes input delivered by InputService. Check UserInputType before reading fields whose meaning depends on the device.

Summary

Members8
Properties7
Methods1
  • IsA(string): boolean

    Returns whether the input value matches the supplied type name.

Properties

ClassName

InputObject.ClassName: string

The runtime type name of the input value.

Delta

InputObject.Delta: Vector3

The position change since the previous input event. Use this for relative motion when the pointer is locked.

KeyCode

InputObject.KeyCode: EnumItem

The key or gamepad button as an Enum.KeyCode. Non-button input uses Unknown.

Name

InputObject.Name: string

The name of the input value.

Position

InputObject.Position: Vector3

The input position. Pointer and touch input use screen coordinates; the third component carries scroll input. Thumbstick input uses axis deflection.

UserInputState

InputObject.UserInputState: EnumItem

The input lifecycle state: beginning, change, or end.

UserInputType

InputObject.UserInputType: EnumItem

The input category, such as keyboard, mouse button, touch, or gamepad.

Methods

IsA

InputObject:IsA(string): boolean

Returns whether the input value matches the supplied type name.

Operators

__tostring · __type

Example

Luau
local InputService = game:GetService("InputService")
InputService.Began:Connect(function(input, gameProcessed)
  if not gameProcessed then
    print(input.UserInputType)
  end
end)

Used by

Frame · ImageButton · ImageLabel · InputService · SceneFrame · ScrollingFrame · TextBox · TextButton · TextLabel

InputService · Enum.KeyCode · Enum.UserInputType · Vector3