Yuari
Documentation

keydown

Alias of iskeypressed.

Syntax

keydown(key: number | string | Enum.KeyCode) -> boolean

Parameters

ParameterTypeDescription
keynumber | string | Enum.KeyCodeVirtual-key code, key name or Enum.KeyCode item.

Returns

TypeDescription
booleanTrue while the key is held and the game is focused.

Description

The function accepts the same formats as iskeypressed, including letters, digits, function keys and names such as "space", "shift", "ctrl" and "escape".

Example

if keydown("e") then
    print("E held")
end

Notes

  • It reports false when the Roblox window is not focused.
  • Use keyup style logic by tracking the previous state in your script.