Forest Logo
search
package_2

fluxinput

By @a1ternativez

Roblox

Mirrored

FluxInput

FluxInput is a modular input management system for Roblox. It provides a unified API for handling keyboard, gamepad, and touch inputs.

It supports:

  • Input contexts (categories)
  • Dynamic key rebinding
  • Input cooldowns
  • Hold input detection
  • Event-based handling (pressed / released)

📥 Installation

🔗 Latest Release

Download or access the latest version of FluxInput here:

👉 FluxInput Latest Release


📦 Core Types

KeycodeSet

Device-specific input bindings:

type KeycodeSet = {
    KeyboardBinding: { Enum.KeyCode }?,
    GamepadBinding: { Enum.KeyCode }?,
    TouchBinding: { GuiButton }?,
}


InputInstance

Object returned when an input action is registered:

type InputInstance = {
    Keys: KeycodeSet,
    Cooldown: number,
    LastPressTime: number,
    Enabled: boolean,
    Destroyed: boolean,

    Context: InputContext,
    Action: InputAction,

    PressedCallbacks: { (any) -> () },
    ReleasedCallbacks: { (any) -> () },
    HoldCallbacks: { {Duration: number, Func: (any) -> ()} },
}


⚙️ API

Input.New

Creates and registers a new input action inside a context.

Input.New(
    category: string,
    name: string,
    keys: KeycodeSet,
    cooldown: number?
) -> InputInstance


InputInstance Methods


Event Connections

ConnectPressed(func: () -> ()) -> RBXScriptConnection -- pressed signal
ConnectReleased(func: () -> ()) -> RBXScriptConnection -- released signal
ConnectHold(duration: number, func: () -> ()) -> RBXScriptConnection -- hold signal
Connect(func: () -> ()) -> RBXScriptConnection -- alias for ConnectPressed


Key Management

ChangeKeys(keys: KeycodeSet) -> () -- change keybinds


State Control

SetState(state: boolean) -> ()          -- enable/disable this input
SetContextState(state: boolean) -> ()   -- enable/disable entire category


Cleanup

Destroy() -> () -- destroys input


🎮 Usage Examples


1. Simple Keyboard Input

local Input = require(FluxInput)

local jump = Input.New(
	"Player",
	"Jump",
	{
		KeyboardBinding = { Enum.KeyCode.Space }
	},
	0.2
)

jump:ConnectPressed(function()
	print("Jump!")
end)

2. Press / Release

local sprint = Input.New(
	"Player",
	"Sprint",
	{
		KeyboardBinding = { Enum.KeyCode.LeftShift }
	}
)

sprint:ConnectPressed(function()
	print("Sprint ON")
end)

sprint:ConnectReleased(function()
	print("Sprint OFF")
end)

3. Keyboard + Gamepad

local shoot = Input.New(
	"Combat",
	"Shoot",
	{
		KeyboardBinding = { Enum.KeyCode.F },
		GamepadBinding = { Enum.KeyCode.ButtonR2 }
	}
)

shoot:Connect(function()
	print("Shoot")
end)

4. Touch Input

local button = script.Parent:WaitForChild("JumpButton")

local jump = Input.New(
	"Player",
	"Jump",
	{
		KeyboardBinding = { Enum.KeyCode.Space },
		TouchBinding = { button }
	}
)

jump:Connect(function()
	print("Jump")
end)

5. Rebinding Keys

reload:ChangeKeys({
	KeyboardBinding = { Enum.KeyCode.T }
})

6. Enable / Disable Input

dash:SetState(false)
dash:SetState(true)

7. Disable Entire Category

dash:SetContextState(false)

8. Destroy Input

dash:Destroy()

9. Hold Input

Triggers only if the key is held for the specified duration.

local Input = require(FluxInput)

local Charge = Input.New(
    "Combat",
    "ChargeBlast",
    {
        KeyboardBinding = { Enum.KeyCode.E }
    }
)

Charge:ConnectHold(1.5, function()
    print("Blast charged!")
end)


10. Combined Press and Hold

local ability = Input.New(
    "Combat",
    "Ultimate",
    {
        KeyboardBinding = { Enum.KeyCode.Q }
    }
)

ability:ConnectPressed(function()
    print("Charging Ultimate...")
end)

ability:ConnectHold(3, function()
    print("Ultimate Released!")
end)

ability:ConnectReleased(function()
    print("Charge Interrupted")
end)

Package Details

Install command (Click to copy)


Version

2.1.1

License

MIT

check_circle

Safe for commercial use

infoLicense identified from the packaged LICENSE file; the manifest declared none.

Automated license review — not legal advice.