Idle Animation for NPC not stopping

Code That stops the animation: game.Workspace.Boy.Script4.Enabled = false
game.Workspace.Boy.Script5.Enabled = true

Code that runs the animation: local animation = script:WaitForChild(‘Dance’)
local humanoid = script.Parent:WaitForChild(‘Humanoid’)
local dance = humanoid:LoadAnimation(animation)
dance:play()

I can’t get the aniamtion to stop running and it stills runs while another animation runs.

Does the NPC have a Humanoid inside it?

Yes it does, so that’s why I’m not sure what the issue is

local AnimationTracks = game.Workspace.Boy.Humanoid:GetPlayingAnimationTracks()
			-- Stop all playing animations
			for i, track in pairs (AnimationTracks) do
				track:Stop()
			end

use this when you want to stop the animations.

1 Like

What is the animation priority set to for the animations.

I set as idle currently. Still not sure

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.