Roblox Input

TabooHarmony/roblox-brain/skills/gameplay/roblox-input

by TabooHarmony38826be57ee37bcf023e9c2b85681bea3909281cNo licenseListed Oct 9, 2026Updated Oct 9, 2026

Use when handling Roblox keyboard, mouse, gamepad, touch, motion input, or cross-platform action binding.

Instructions onlySoftware Development
AI-generated overview

Reference guidance for handling Roblox keyboard, mouse, gamepad, touch and motion input, including cross-platform action binding.

What it does
Provides reference guidance on Roblox input handling: UserInputService events, ContextActionService action binding, Server Authority input actions, gamepad focus, touch gestures and drag detectors. It lists pitfalls such as gameProcessedEvent filtering, binding priority and client-only execution. It points to a fuller reference file for event tables and polling methods.
When to use it
Use when writing or reviewing Roblox client-side input code for keyboard, mouse, gamepad, touch or motion, or when binding actions across platforms. Also relevant when input must affect a Server Authority simulation.
Requirements
No scripts; instructions only. Requires a Roblox development context (Luau, Roblox Studio) and access to the bundled reference file.

Roblox Input

When to Load

Load for keyboard, mouse, gamepad, touch, motion, or cross-platform action binding. Client-side only. For simulation-affecting input in a Server Authority project, use the Input Action System rather than traditional input events.

Quick Reference

Core events (UserInputService): InputBegan, InputChanged, InputEnded fire as (input: InputObject, gameProcessedEvent: boolean). InputBegan does NOT fire for mouse wheel. Events only fire while the client window is focused.

Prefer ContextActionService over InputBegan for gameplay: free conflict resolution (chat won't steal H) and free mobile buttons:

luau
local CAS = game:GetService("ContextActionService")
local function onAction(name, state, _input)    if name == "Jump" and state == Enum.UserInputState.Begin then        humanoid.Jump = true    endend
CAS:BindAction("Jump", onAction, true,    Enum.KeyCode.Space, Enum.KeyCode.ButtonA)

BindAction(name, handler, createTouchButton, ...inputTypes). Handler returns ContextActionResult.Sink to consume, .Pass to fall through.

Server Authority: use InputAction/InputContext for inputs that affect the core simulation, store the input state where the synchronized simulation can read it, and process it through RunService:BindToSimulation() (requires Workspace.UseFixedSimulation enabled in Studio). ContextActionService remains appropriate for UI-only or classic-project actions.

Gamepad UI focus: separate gameplay bindings from menu selection. Set GuiService.SelectedObject, mark controls Selectable, and test nested/modal navigation.

Gamepad: use GetConnectedGamepads() and listen to connection changes.

Touch: use high-level gesture events or raw TouchStarted/TouchMoved/TouchEnded when tracking fingers.

Dragging: DragDetector (3D parts/models, physics-capable) and UIDragDetector (UI) make objects draggable with zero code; events DragStart/DragContinue/DragEnd.

Pitfalls:

  • gameProcessedEvent=true in InputBegan → UI consumed it. Filter for gameplay.
  • BindAction is stack-based: most-recent wins. Use BindActionAtPriority.
  • Client-only. Server scripts silently no-op.
  • JumpRequest fires multiple times per jump; debounce.
  • Mouse wheel only fires InputChanged.

Full event tables and polling methods: references/full.md.

Source and attribution

Source:TabooHarmony/roblox-braininskills/gameplay/roblox-inputat commit38826be

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal