InputRegistry (v1.0)
Input Registry is a lightweight framework module that makes handling user input much easier. I made this to make handling user inputs easier. I will personally maintain this module, so suggestions, bug reports are more than welcomed.
Features
- Lightweight. Fully event-based
- Fully type-checked and commented. Easy coding!
- Unlimited input methods, even on same device
- Most methods are chainable
- Easy input-disabling
- Built-in trigger types
- Runtime binding modifications
Interested? Let’s dive in.
Example - Basic Sprinting System
First, get a ScreenGui that holds the Sprinting button for mobiles ready.
NOTE: Disable Shift Lock first otherwise you will not be able to shift-to-sprint.
local RF = game:GetService("ReplicatedFirst")
local Players = game:GetService("Players")
local InputRegistry = require(RF:WaitForChild("InputRegistry"))
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
-->> Assuming you have these ready..
local sprintGui = playerGui:WaitForChild("SprintGui")
local sprintBtn = sprintGui:WaitForChild("SprintBtn")
-->> Register a Registry to handle inputs
local sprintRegistry = InputRegistry.Register("Sprint")
sprintRegistry:AddInput(Enum.KeyCode.LeftShift, "Hold")
sprintRegistry:AddInput(Enum.KeyCode.ButtonB, "Toggle")
sprintRegistry:AddInput(sprintBtn, "Toggle")
sprintRegistry.StatusChanged:Connect(function(status)
if not player.Character then return end
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
-->> Status is either "Active" or "Idle"
if status == "Active" then
humanoid.WalkSpeed = 24
else
humanoid.WalkSpeed = 16
end
end)
Internal Types
Types
-->> ALL OF THESE ARE USED INTERNALLY AND ARE NOT ACCESSIBLE FOR EXTERNAL USE!!!
type InputType = "Keybind" | "UIButton"
type InputInst = Enum.KeyCode | GuiButton
type TriggerType = "Click" | "Hold" | "Toggle"
Use Cases
Method Chaining
return InputRegistry.Register("MyRegistry")
:AddInput(Enum.KeyCode.LeftShift, "Hold")
:AddInput(Enum.KeyCode.ButtonB, "Toggle")
:AddInput(someKindOfButton, "Toggle")
Runtime Binds Editing
local registry = InputRegistry.Register("registry")
task.wait(1)
-->> Yes, just that simple!
registry:AddInput(Enum.KeyCode.LeftShift, "Hold")
Custom Keybinds Integration
local function modifyKeybind(keybind: Enum.Keycode)
registry:RemoveInput(keybind)
registry:AddInput(ketbind, "Click")
end
-->> This is if you want to modify keybind to LeftShift
modifyKeybind(Enum.Keycode.LeftShift)
Detecting Modifier Keys
registry.InputStarted:Connect(function(inputInstance, modifierKeys: {Enum.Modifierkey})
for i, v in modifierKeys do
print(`Modifier key {v} is pressed!`)
end
end)
License
MIT License
Copyright [2026+] [The Creator]
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in the
Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Wait, before you go..
Rate this module from 1 to 5! (5 = highest)
- 1
- 2
- 3
- 4
- 5
0
voters
Will you use InputRegistry?
- Yes, this looks useful!
- I don’t think I need it yet.
- It isn’t that good to be used.
0
voters
Suggestions, bug reports, and questions are always welcomed. Happy coding!