Simulates a key press, leaving the key held until you call keyrelease.
The keycode is a Win32 Virtual Key Code, not a Roblox Enum.KeyCode value. For letters, pass the uppercase ASCII byte (string.byte("A") returns 65, which is VK_A). Learn more here.
The Roblox window must be focused for the call to register. See iswindowactive().
The pressed key stays held until you call keyrelease(keycode).
Parameters
Returns
void
Aliases
Example
In a chase or sprint sequence, hold W while the round’s Sprint Sound is playing under workspace and release the moment it ends.
Remember to call keyrelease to prevent the key from being stuck down.