Services
UserInputService
Keyboard, mouse and cursor input for client-side Glorpia scripts.
Access
Luau
local UserInputService = game:GetService("UserInputService")UserInputService is available to public LocalScripts and Glorpia CoreScripts. Public ServerScripts 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)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.