Attack animation keep on playing

I want to add an Attack state to my already existing state machine with idle to walk/run state. It run alright without anybattacj state but when i add attac state and compile it immediately starts to play that attack animation without taking any inputs from user. How can i execute my state machine normally? Like it starts from idle go to walk/run and when i press R key it play that attack anime.

A picture of your statemachine would help to see how it’s been set up.

I’m currently getting into animations and Animation Blueprints myself, so I can’t say that I’m that confident in the subject.
It does however sound like you’re running directly into the attack animation without there being any transition rules in place.

Image below is of an Animation Blueprint for a deer.
When I hit play, the deer is in it’s idle state.
The lines between the Idle-state and “walk” have transition rules. Do you have anything like this?


With these rules (and some Blueprinting in the AnimGraph of the Animation Blueprint) I can basically say that that whenever the deer stands still, it should play its Ide animation. Whenever velocity in the X or Y axis is detected, play the deers Walk/Run animation.