Reference API Roblox

Engine API

Website

Related

Reference API Roblox

InputObject

An object created when an input begins that describes a particular user input.

This class is not creatable. Instances of this class cannot be created with Instance.new.
Tags: [NotCreatable]

Member index 6

HistoryMember
553Delta: Vector3
553KeyCode: KeyCode
553Position: Vector3
553UserInputState: UserInputState
553UserInputType: UserInputType
462IsModifierKeyDown(modifierKey: ModifierKey): bool
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553ClassName: string
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
553className: string
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
486GetChildren(): Objects
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
462GetPropertyChangedSignal(property: string): RBXScriptSignal
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsA(className: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
553children(): Objects
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
553getChildren(): Objects
462isA(className: string): bool
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462Changed(property: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)

Description

An InputObject represents a single user input, such as mouse movement, touches, key presses and more. It is created when an input begins.

The properties of this object vary according the UserInputType. Each kind of input will undergo various changes to its UserInputState. During the lifetime of an input, other properties which further describe the input may change, such as Position and Delta. Keyboard and gamepad button presses will have the KeyCode property set.

Once created at the beginning of an input, the same object persists and is updated until the input ends. As a result, you can track the object's changes using the Changed event as the user changes the input in question. You can also place these objects into a list of active inputs track and interact with the object after it's creation by an event such as UserInputService.InputBegan. This is mostly useful for touch events, as each touch point will have a separate InputObject.

See also:

History 23

Members 6

Delta

TypeDefault
Vector30, 0, 0

A Vector3 describing the Delta (change) between mouse/joystick movements.

This is useful when used with the input's position to track the position and movement of the user's mouse/joystick, such as when you're creating custom movement or camera scripts. Consider tracking input object changes using the Instance.Changed event or when user input changes via events such as UserInputService.InputChanged and GuiObject.InputChanged.

Note that an InputObject corresponding to UserInputType.MouseButton1 (left click) and UserInputType.MouseButton2 (right click) supplied from an InputBegan callback will not have its Delta or Position updated once created, except for when the mouse input ends. In order to get updated deltas for mouse inputs, you must instead reference an InputObject from an InputChanged callback, or call GetMouseDelta(). However, any InputObjects corresponding to touch inputs will have their delta and position updated every frame throughout their lifetime.

See also:

History 4

IsModifierKeyDown

Parameters (1)
modifierKeyModifierKey
Returns (1)
bool

History 2

KeyCode

TypeDefault
KeyCodeUnknown

Contains a KeyCode enum that describes what kind of input was used. For types of input like keyboard, this describes what key was pressed. For inputs like the mouse, this provides no additional information.

Enums

NameValueDescription
Unknown0
Backspace8
Tab9
Clear12
Return13
Pause19
Escape27
Space32
QuotedDouble34
Hash35
Dollar36
Percent37
Ampersand38
Quote39
LeftParenthesis40
RightParenthesis41
Asterisk42
Plus43
Comma44
Minus45
Period46
Slash47
Zero48
One49
Two50
Three51
Four52
Five53
Six54
Seven55
Eight56
Nine57
Colon58
Semicolon59
LessThan60
Equals61
GreaterThan62
Question63
At64
LeftBracket91
BackSlash92
RightBracket93
Caret94
Underscore95
Backquote96
A97
B98
C99
D100
E101
F102
G103
H104
I105
J106
K107
L108
M109
N110
O111
P112
Q113
R114
S115
T116
U117
V118
W119
X120
Y121
Z122
LeftCurly123
Pipe124
RightCurly125
Tilde126
Delete127
KeypadZero256
KeypadOne257
KeypadTwo258
KeypadThree259
KeypadFour260
KeypadFive261
KeypadSix262
KeypadSeven263
KeypadEight264
KeypadNine265
KeypadPeriod266
KeypadDivide267
KeypadMultiply268
KeypadMinus269
KeypadPlus270
KeypadEnter271
KeypadEquals272
Up273
Down274
Right275
Left276
Insert277
Home278
End279
PageUp280
PageDown281
LeftShift304
RightShift303
LeftMeta310
RightMeta309
LeftAlt308
RightAlt307
LeftControl306
RightControl305
CapsLock301
NumLock300
ScrollLock302
LeftSuper311
RightSuper312
Mode313
Compose314
Help315
Print316
SysReq317
Break318
Menu319
Power320
Euro321
Undo322
F1282
F2283
F3284
F4285
F5286
F6287
F7288
F8289
F9290
F10291
F11292
F12293
F13294
F14295
F15296
World0160
World1161
World2162
World3163
World4164
World5165
World6166
World7167
World8168
World9169
World10170
World11171
World12172
World13173
World14174
World15175
World16176
World17177
World18178
World19179
World20180
World21181
World22182
World23183
World24184
World25185
World26186
World27187
World28188
World29189
World30190
World31191
World32192
World33193
World34194
World35195
World36196
World37197
World38198
World39199
World40200
World41201
World42202
World43203
World44204
World45205
World46206
World47207
World48208
World49209
World50210
World51211
World52212
World53213
World54214
World55215
World56216
World57217
World58218
World59219
World60220
World61221
World62222
World63223
World64224
World65225
World66226
World67227
World68228
World69229
World70230
World71231
World72232
World73233
World74234
World75235
World76236
World77237
World78238
World79239
World80240
World81241
World82242
World83243
World84244
World85245
World86246
World87247
World88248
World89249
World90250
World91251
World92252
World93253
World94254
World95255
ButtonX1000
ButtonY1001
ButtonA1002
ButtonB1003
ButtonR11004
ButtonL11005
ButtonR21006
ButtonL21007
ButtonR31008
ButtonL31009
ButtonStart1010
ButtonSelect1011
DPadLeft1012
DPadRight1013
DPadUp1014
DPadDown1015
Thumbstick11016
Thumbstick21017

See also:

History 4

Position

TypeDefault
Vector30, 0, 0

This property describes a Vector3 positional value of this input.

For mouse and touch input, this is the screen position of the mouse/touch, described in the X and Y components. The inset applied to GUI elements (such as from the top bar) is accounted for in the position.

For the mouse wheel input, the Z component describes whether the wheel was moved forward (1), backwards (-1), or not at all (0).

For KeyCode input, this indicates the position of the player's Mouse.

Note that an InputObject corresponding to UserInputType.MouseButton1 (left click) and UserInputType.MouseButton2 (right click) supplied from an InputBegan callback will not have its Delta or Position updated once created, except for when the mouse input ends. In order to get updated positions for mouse inputs, you must instead reference an InputObject from an InputChanged callback, or call GetMouseLocation(). However, any InputObjects corresponding to touch inputs will have their delta and position updated every frame throughout their lifetime.

See also

History 4

UserInputState

TypeDefault
UserInputStateNone

UserInputState describes the state of an input being performed, following a specific flow depending on the UserInputType. It uses the enum of the same name, UserInputState. See the enum page for a list of all possible values for this property.

See also:

History 4

UserInputType

TypeDefault
UserInputTypeNone

UserInputType is a property that describes for what kind of input this InputObject represents, such as mouse, keyboard, touch or gamepad input. It uses the enum of the same name, UserInputType. See the enum page for a list of all possible values for this property.

See also:

History 4

Settings