Repeated press of the input key


I have a situation in my game scenario for Windows eventually for PlayStation. But not sure what is the best way to achieve what I described below. There is a closed door in the level. The player has to repeatedly press the input key for 10 times (within 3 seconds) to completely open the door. If the player pressed only for 5 times repeatedly and stops to press the key, then the door has to close again. I am not sure how to do this. Can someone please help me by giving some idea on how to do it.

Thanks in advance.

something like this would work.

You can do it like this

But this will open the door once they get it right. If you mean the door should open a little every time they press the key, but shut if they don’t get it right, that’s another piece of code.

Thank You so much. I will try this.

Thanks so much. I will try this.