Input
Simulate mouse and keyboard input in the Roblox window.
Input functions send real input events to the Roblox window, as if they came from your mouse and keyboard. They only take effect while Roblox is the focused window. Check with isrbxactive.
Mouse buttons
mouse1click
since 1.0.0mouse1click(): ()Presses and releases the left mouse button.
Example
mouse1press
since 1.0.0mouse1press(): ()Presses the left mouse button and holds it until mouse1release is called.
Example
mouse1release
since 1.0.0mouse1release(): ()Releases the left mouse button.
Example
mouse2click
since 1.0.0mouse2click(): ()Presses and releases the right mouse button. mouse2press and mouse2release hold and release it separately.
Example
Mouse movement
mousemoverel
since 1.0.0mousemoverel(x: number, y: number): ()Moves the cursor by x and y pixels from where it is now.
Parameters
xnumber- Horizontal distance. Positive moves right.
ynumber- Vertical distance. Positive moves down.
Example
mousemoveabs
since 1.0.0mousemoveabs(x: number, y: number): ()Moves the cursor to x, y, in pixels from the top-left of the Roblox window's content area.
Parameters
xnumber- Horizontal position.
ynumber- Vertical position.
Example
Keyboard
keypress
since 1.0.0keypress(keycode: number): ()Presses the key with the Windows virtual-key code keycode and holds it until keyrelease.
Parameters
keycodenumber- A virtual-key code. See the table below.
Example
keyrelease
since 1.0.0keyrelease(keycode: number): ()Releases the key with the virtual-key code keycode. Pair every keypress with one.
Parameters
keycodenumber- A virtual-key code.
Example
Common key codes
Window
isrbxactive
since 1.0.0isrbxactive(): booleanReturns whether the Roblox window is focused. Input functions do nothing while it isn't.
Also available as isgameactive.
Returns
booleantrue when Roblox has focus.
Example
Written for Lynx 0.0.0
Something unclear? Tell us on Discord