How do I do a running attack?

I am working on a 3d adventure game. I dealt with movement and i am working on attacking. I wanna do a running attack but problem is that it sometimes plays the animation. It feels random. It would be great if anybody would help.,I am maling a 3d adventuver game. I dealt with movement and Working on attacking. But when i wanna do a running attack sometimes it works sometimes it dont. I am really frustrated by this so if you help that would be great.

You’ll want to create a secondary layer in your Animation Controller that will handle just the upper body. You can have it do that by applying a mask to the layer that only affects the upper body bones in the armature. Then you set it up as you would on the base layer so that the attack animation plays when you want it to. Now when you press the attack button the upper body will perform the attack animation while the lower body (still being controller by the base layer) continues to perform the run animation.

You can see more about it here. The video is from Unity 5 but it still works the same way. Good luck!