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)
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.
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.
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.)
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.
Do you know if this would work like, i have a running system, and i want to hold shift to run, but there’s also a crouching system, in my case, i need that, if you are crouching, and then u hold Shift, u stop crouching and begin to run, only if you’re moving, i could implement this with your module?, overwriting states