IsKeyDown
Whether a key is held down right now.
The keys as OnKey names them (w, lshift, lalt, space …). It follows the keys pressed since the script first
asked (or defined OnKey): a key already held at that moment reads false until it is pressed again. Like OnKey,
it never sees what is typed into a server page or the chat box, and every key reads false while the game window is not
in front.
Syntax
Section titled “Syntax”IsKeyDown(key)| Parameter | Type | |
|---|---|---|
key |
string | the key’s engine name |
Returns
Section titled “Returns”boolean - true while the key is held
Example
Section titled “Example”-- Shift + click: a quick salefunction OnMouseButton(button, pressed, x, y) if button == "left" and pressed and (IsKeyDown("lshift") or IsKeyDown("rshift")) then SendServerEvent("quick_sell", tostring(x) .. "," .. tostring(y)) endendSee also
Section titled “See also”OnKey · SetKeyboardCapture · the The game’s UI for a script group of the index
