AI script, attack problem

So after toiling away with my AI script for about a week I finally got it done( almost) my enemy finally attacks at random intervals and everything. But therein lies the problem, when he attacks I want him to play an animation called attack. He does play it but only halfway and then he stops and starts it all over again. I don’t know exactly why this is happening so I decided to get some help since I need to present my game in a few days. Here is my script, help me figure this out please! :slight_smile:

UPDATE: Problem solved, new one has arisen, look below :slight_smile:

Solved, only had to change the animation layer at the time of attacking :slight_smile: so if i wasnt it would revert back to it’s original layer state and be affected by the others :slight_smile: