NPC stops doing walking animation

I have an enemy AI that does what you’d expect in terms of melee-combat. A big issue visual-wise, however, is that it tends to stop doing its walking animation and instead just A-poses, sliding across the ground. It seems to just slide whenever, and very rarely actually do the walking animation. There is nothing in the ai code that affects or even relates to the walking anim, and I do have the default Roblox animation script inside the model (yes, as a server script).

I’ve tried looking all around and have come across nothing relating to such an issue.

1 Like

Try putting prints in to each logic path to see where its is failing.
Perhaps a ‘monitoring’ piece that simply prints out the state of the animation where you expect it to be running.

Did you set the animation to movement?
Screenshot 2021-05-19 075306

It is at movement, yes. Even if it wasnt then id like to think it would still play over the A-pose

I had already done this. It doesnt seem to do it at any specific function, it just starts doing it right off the bat once a player enters detection.
Oddly enough, it’ll keep doing its walking animation for dummies and other npcs, but not for the player. What’s concerning about that, however, is the fact I dont have it looking for any difference between the two; Its set to only look for a humanoidRootPart and a name in workspace, so I’m not sure why it treats the two differently. Perhaps just an issue with Studio?

I have solved the issue by totally ditching Roblox’s animation script and just doing my own simple, custom lines. (Anim objects go inside of script)

local walkAnimPlaying = false

idle = myHuman:LoadAnimation(script:WaitForChild("IdleAnim"))
idle:Play() --npc does idle anim on spawn


  if checkDirect(target) then
		if targetDistance > 3 then
			chase(target) --when the npc should be walking
			
			if walkAnimPlaying == false then --checks if walk anim is already playing
				walkAnimPlaying = true

				idle:Stop() --prevents multiple instances from playing at once
				walking = myHuman:LoadAnimation(script:WaitForChild("WalkAnim"))
				walking:Play()
			end
		end
		if targetDistance < 3 + 1 then 
			attack(target) --when npc shouldnt be walking
			
			if walkAnimPlaying == true then
				walkAnimPlaying = false

				walking:Stop()
				idle = myHuman:LoadAnimation(script:WaitForChild("IdleAnim"))
				idle:Play()
			end
		end
2 Likes