---
title: "UserInputService"
description: "Keyboard, mouse and cursor input for client-side Glorpia scripts."
canonical: "https://docs.glorpia.com/services/userinputservice"
markdown: "https://docs.glorpia.com/services/userinputservice.md"
---
# UserInputService

Keyboard, mouse and cursor input for client-side Glorpia scripts.

**Category:** Services

## Access

```luau
local UserInputService = game:GetService("UserInputService")
```

> **Note:** `UserInputService` is available to public `LocalScript`s and Glorpia CoreScripts. Public `ServerScript`s receive a runtime permission error if they request it.

## Signals and properties

| Name | Type | Description |
| --- | --- | --- |
| `InputBegan` | signal | Fires when a supported keyboard or mouse button input begins. |
| `InputChanged` | signal | Fires for mouse movement and mouse wheel input. |
| `InputEnded` | signal | Fires when a supported keyboard or mouse button input ends. |
| `MouseBehavior` | Enum.MouseBehavior | Read/write cursor behaviour. |

## Methods

| Name | Type | Description |
| --- | --- | --- |
| `IsKeyDown(key)` | boolean | Checks whether a supported Enum.KeyCode is currently held. |
| `GetMouseDelta()` | Vector2 | Returns accumulated mouse movement for the current frame. |
| `IsMouseButtonPressed(type)` | boolean | Checks MouseButton1, MouseButton2 or MouseButton3. |

## Example: React To Space

```luau
local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if input.KeyCode == Enum.KeyCode.Space then
        print("Space pressed")
    end
end)
```

> **Note:** Input events pass `false` as the second signal argument in the current runtime. `Enum.KeyCode` includes the Roblox-style computer keyboard names; gamepad and touch key codes are not part of this keyboard-only pass.

## Related

- [LocalScript](https://docs.glorpia.com/instances/localscript.md) — Creator client scripts that can read user input.
- [Enums & Input](https://docs.glorpia.com/scripting/enums.md) — Supported key codes, input types, input states and mouse behaviours.
- [Signals & Connect()](https://docs.glorpia.com/scripting/functions/signals.md) — How to connect and disconnect event callbacks.
