Input
The Input class provides a way to listen for key events such as presses or releases. You can bind custom functions to specific keys, allowing for flexible input handling.
Authority: Client -- All input methods are client-side only.
tip
- When using a key to set input mode, the key "released" event will automatically trigger.
- For example, binding a pressed key to open a WebUI will cause its "released" counterpart to trigger when you use
SetInputMode(1).
Methods
| Method | Parameters | Return Type | Authority | Description |
|---|---|---|---|---|
Input.BindKey | Key: string, Callback: function, ListenerType?: string | void | Client | Binds a function to an event listener type for a specific key. ListenerType defaults to "Pressed". Can also be "Released". |
Examples
Binding Key Events
- Blueprint
- Lua
- JavaScript
// Input bindings are handled via Lua or JavaScript scripting on the client.
-- Bind to Tab key press
Input.BindKey('Tab', function()
print('Tab Pressed')
end, 'Pressed')
-- Bind to Tab key release
Input.BindKey('Tab', function()
print('Tab Released')
end, 'Released')
// Input bindings follow the same pattern via PuerTS or Helix JS bindings.
// Refer to the Lua examples for function signatures.
note
Input bindings persist until the client disconnects. If you bind actions in a temporary game mode, remember to manage your bindings appropriately when the mode ends.