keypress(vk) / keyrelease(vk) / keyclick(vk) / keytap(vk)
Sends keyboard input through SendInput with proper scan codes.
Syntax
keypress(vk: number) -> ()
keyrelease(vk: number) -> ()
keyclick(vk: number) -> ()
Parameters
| Parameter | Type | Description |
|---|---|---|
vk | number | Virtual-key code (for example 0x4A for J). |
Returns
| Type | Description |
|---|---|
() | No return values. |
Description
Logic change: input is now injected with SendInput and MapVirtualKey scan codes instead of keybd_event with a zero scan code, so Roblox UserInputService receives KeyCode events and IsKeyDown reflects the state.
keyclick presses and releases with a 10 ms gap; keyrelease must follow keypress.
Example
keyclick(0x4A) -- tap J
keypress(0x4A)
task.wait(0.1)
keyrelease(0x4A)
Notes
- The Roblox window must be focused.