Skip to content

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.

IsKeyDown(key)
Parameter Type
key string the key’s engine name

boolean - true while the key is held

-- Shift + click: a quick sale
function OnMouseButton(button, pressed, x, y)
if button == "left" and pressed and (IsKeyDown("lshift") or IsKeyDown("rshift")) then
SendServerEvent("quick_sell", tostring(x) .. "," .. tostring(y))
end
end

OnKey · SetKeyboardCapture · the The game’s UI for a script group of the index