keypress Synchronous

  • keytap

Send a key-down event and leave that key held. Use it for an intentional hold, then send the matching keyrelease even if the work in between fails.

Syntax
Luau
keypress(keyCode: number) -> ()

Parameters

Function parameters
ParameterTypeDescription
keyCodenumberWindows virtual-key code. Kawaii maps supported codes to Android key events; for example, 0x41 is A and 0x0D is Enter.

Returns

()

No values.

Usage notes

Unsupported key codes have no visible effect. This sends an input event; it does not insert an arbitrary text string.

Example

Example
Luau
if isrbxactive() then
    keypress(0x41) -- A
    task.wait(0.1)
    keyrelease(0x41)
end
Kawaii documentation