Glorpia Docs
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

NameTypeDescription
InputBegansignalFires when a supported keyboard or mouse button input begins.
InputChangedsignalFires for mouse movement and mouse wheel input.
InputEndedsignalFires when a supported keyboard or mouse button input ends.
MouseBehaviorEnum.MouseBehaviorRead/write cursor behaviour.

Methods

NameTypeDescription
IsKeyDown(key)booleanChecks whether a supported Enum.KeyCode is currently held.
GetMouseDelta()Vector2Returns accumulated mouse movement for the current frame.
IsMouseButtonPressed(type)booleanChecks 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.

Related