So I have an NPC that moves and does NPC stuff, but it doesn't play animations. I have this script

 local controller = script.Parent.Humanoid

  

local walk = Instance.new("Animation")

walk.AnimationId = ("rbxassetid://837009922")

local walktrack = controller:LoadAnimation(walk)

walktrack.Looped = true

  

local idle = Instance.new("Animation")

idle.AnimationId = ("rbxassetid://837011741")

local idletrack = controller:LoadAnimation(idle)

idletrack.Looped = true

  

script.Parent.Humanoid.Running:Connect(function(speed)

if speed ~= 0 then

walktrack:Play()

idletrack:Stop()

print("Walking")

elseif speed == 0 then

walktrack:Stop()

idletrack:Play()

print("Not walking")

end

end)

But it uh... doesn't do anything. I don't get any errors, but I do get 'Walking' and 'Not Walking'. Any help?

2 comments

0

It's a problem with your actual animations, not the script. Try replacing your IDs with ROBLOX's default ones as a test: rbxassetid://913402848 for walk and rbxassetid://507766388 for idle.

0

Yes! that worked! can you post an answer so i can accept it?