How do I play a full animation by just pressing a key?

So I started with the third person blueprint and want to make an attack animation. Just a simple, press “1” and the animation plays in full.

I have it set up right now like the “IsInAir?” boolean called “IsAttacking?”, so IsAttacking? Yes, play animation, IsAttacking? to NOT boolean, returns to idle.

The problem is that if i just press the key the animation starts a little then returns to idle, if i hold it down it plays fully then repeats. I dont want either of these events to occur.

I want to press the key and it plays entirely without having to hold it down, and if i do hold it down the animation shouldnt repeat and just returns to idle.

Can someone help me out with this?

You can trigger an animation directly in your Character Blueprint.

This will override the AnimGraph as long as the animation is running.

Alternatively, if you use a boolean as a transition condition in the AnimGraph, you need to make sure not to include it in the transition state back to the idle. Just check whether the remaining time is low enough that you should start to fade to the next animation.

52089-animationendtransition.png