How to make a Key Bind sequence

Hello! So I’m trying to make something for my friend’s game and I need to have a button sequence.
For example the player would press this sequence on their keyboard: “up, up, down, down, left, right, left, right, a, b” and a animation would play.

I’ve looked this up a few times and all I could find was one video that was very hard to follow.
Thanks for the help!

P.S. I don’t have any current code dew to the fact that the only thing I could find was the video that I mentioned. Sorry.

To achieve this, you would need to create a system that waits for all the keys to be pressed (and if a wrong key is pressed then obviously clear the progress) and then execute a callback function if successful.

1 Like

I figured that would be how I would do it but I’m now quite sure how I would do that.
I apologize for the trouble.

I actually made an open source script for keybinds after I saw this, so here’s the link to it:

1 Like

That worked perfectly!! Thank you so much. And sorry for making you go out of your way to make a script.

1 Like

It worked that one time but now for some reason it’s not working anymore…Sorry

Do you have it set to work only once?

1 Like

Ah I didn’t realize you had a custom attribute on the script. I turned that off. Thanks!

1 Like

So I turned that off but it still doesn’t work…Sorry again

It works for me, did you alter the script?

Show me your sequence variable. It should be full lowercase.

1 Like

I didn’t change anything. Sorry

Is it because your callback function does nothing?

I’ve updated the callback to print something by default.

1 Like

I’m an Idiot…So I deleted the script to see if that would make it work again and forgot to put code in the callback again…Sorry for the trouble. Thanks for the help!!

1 Like