# getKeyState (Client)

> Tells whether a key is held down right now.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Keyboard
- **URL**: https://wiki.mymp.gg/en/getKeyState

## Syntax

```lua
bool getKeyState(string key)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `key` | `string` | The key's name, in any case: `a` to `z`, `0` to `9`, `F1` to `F12`, `mouse1` to `mouse5`, `mouse_wheel_up`, `mouse_wheel_down`, `arrow_l`, `num_0`, `space`, `enter`, `lshift` and others. |

## Returns

`true` if the key is down, `false` otherwise.

It reads the key itself, even when `onClientKey` was cancelled for it.

## Example

```lua
addEventHandler("onClientRender", root, function()
    if getKeyState("lshift") then
        dxDrawText("Shift held", 20, 20)
    end
end)
```

## See also

- [bindKey (Shared)](https://wiki.mymp.gg/en/bindKey.md): Binds a key to a function or a command. The function runs when the key is pressed, released or both.
- [onClientKey (Client)](https://wiki.mymp.gg/en/onClientKey.md): Fired when a key or mouse button is pressed or released. Cancelling the event stops that key's binds and, on a press, hides the key from the game while it is held.
- [getControlState (Client)](https://wiki.mymp.gg/en/getControlState-client.md): Tells whether one of a ped's controls is pressed, such as forwards, fire or accelerate.
