Input plus: Making input handling easy

Introducing… Input plus!

A compact module for handling sequential input(s) easily and supporting holding input(s).

Why Input plus?

Have you ever wanted to handle sequential inputs such as combos for double jumping,dashing and weapons or holding inputs? Well, Input plus could help you with that with making your code clean and performant. Input plus is very easy to use and supports any amount of keybinds.

Features

Sequence - A sequence of keybinds with delay specified (if delay is nil, no delay is included)
- Any amount of keybinds can be put in the sequence.
- Events to indicate starting of sequence, ending of sequence and pressing of the keybinds
- Feature to cancel the current input or reset the sequence. (Commonly used when gameProcessedEvent is true)
Hold - Any amount of keybinds can be put in the holding list.
- Events to indicate starting of holding,ending of holding and holding of specific keybinds
- Feature to cancel the current input.(Commonly used when gameProcessedEvent is true)

Get the module here : Input plus+

Thanks to my friend @LegendaryElix3r for the “TypeDefinitions” module

Github : GitHub - IBgreat1/Input-Plus: A Luau module for handling sequential input(s) easily and supporting holding input(s)
Docs : API | Input-Plus
Code examples and source code is in the github.

Examples :

Up coming : Support for Mobile (If module gets enough attention)

20 Likes

Great module !!! Got to test it before release, using it was easier than I thought, makes life wayyy easier, will definitely be using this in future projects. :+1: :cold_face:

2 Likes

Good nodule but is there a way I can make crouch and prone on the same key with this module? Sorry I’m new to scripting. :+1:

Yes it’s possible, you can make a sequence with two of the same key and crouch on the first Index and prone on the second index and do the same step for making the player stand.

1 Like

I don’t understand what u mean

This is interesting, I would suggest using metatable operator overrides.
Would be nice to see something like:
(Input.LShift + Input.P).InputBegan as a combination
and maybe create input sequence objects that can also be added together.

(Typed on mobile, might not be formatted correctly.)

I can explain with a code

local Input = require(game.ReplicatedStorage.Input)
-- Taking control as key for crouching/proning
local Return = Input.Sequence.new(nil,Enum.KeyCode.LeftControl,Enum.KeyCode.LeftControl,Enum.KeyCode.LeftControl,Enum.KeyCode.LeftControl)
local State = {'Crouch','Prone','Crouch','Stand'}
-- Order : Standing - Crouching - Proning - Crouching - Standing

Return.Pressed:Connect(function(Input,gp,index)
    if gp then Return:Cancel() return end 
    print(State[index]) -- Returns the current state of crouch/prone/stand
end)

Try running this, the first time you press Control it would print “Crouching” then if you do it again it would print “Proning” then if you do it again it would print “Crouching” cause you are standing from prone to crouch then you do it again it would print “Standing up” cause you standing up from crouch.

Edit : I have edited the examples and have added crouch example.

1 Like

Oh i got you now, but can you tell why this would be needed I can’t think of a scenario where I would have to combine two sequences

Really cool module! I planned to write something similar for one of my projects, but this should significantly reduce the complexity.

Are you fine if I write Roblox-TS typings for this? Would be extremely useful for my project

Good module, might use it for my game.

Yep thats fine, good luck on your project!

Was thinking of writing this up myself but you beat me to it! Great module.

1 Like