Attack state breaks with quick button presses

Okay, so basically I have an attack animation (a sword swing) that works fine unless you press the attack button repeatedly too quickly. You can press the attack button (we’ll say the X button on an XBox 1 controller) at a slow pace as many times as you want, but press it over and over really fast, and without fail, it will never exit the “attack” state preventing you from doing anything until you press jump or something else that I set up to cancel the state.

I have it set up in the character blueprint to set “attacking” to true when the X button is pressed if it is currently false.

Then, the animation blueprint does its cast to character thing (like in the Third Person Tutorial video), and checks if attacking is true or false then plays an animation montage.

I have a notify set up at the end of the montage to set attacking back to false. It is a simple montage with just one segment and animation.

I have tried moving the notify, adjusting the blend in or out time, or whatever, but nothing changes. If I press the button over and over too fast, it breaks every time. Pressing the button over and over at slightly slower pace doesn’t break it, or at least not as often. I just don’t know what to change to fix it. Let me know if you need any more details.

Instead of using a notify to set “attacking” I would try setting the variable after the montage has completed. I would also add a check to see if the montage is playing before you play it again. If the montage is already playing, don’t play it yet.