Context:setcapture
Controls keyboard and mouse capture.
Syntax
Signature
Context:setcapture(Keyboard: boolean, Mouse: boolean) -> ()Aliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Keyboard | boolean | Capture keyboard input while the context lease is active. |
Mouse | boolean | Capture mouse input inside the configured region. |
Returns
| Type | Description |
|---|---|
() | None. |
Notes
Call this regularly while a UI is open. Mouse capture applies inside the configured region and continues while a captured button is held. Focus loss or native editor input can suspend capture.
Example
Luau
local Context = input.createcontext()
Context:setcapture(false, true)
Context:destroy()