I’m trying to make the monster only play an animation when it’s moving.
The monster will not play the animation, because MoveDirection is not changing.
I have tried using MoveToPoint and MoveToPart but neither of them work for what I’m attempting to do
There is no error coming through the output.
local playing = false
while true do
local animator = script.Parent.Humanoid:WaitForChild("Animator")
local animationTrack = animator:LoadAnimation(script.Parent.Humanoid.Walk)
if script.Parent.Humanoid.MoveDirection.Magnitude > 0 then
print("No")
if animator ~= nil then
if playing == false then
print("Playing")
playing = true
animationTrack:Play()
animationTrack.Stopped:Wait()
playing = false
end
end
else
print("Stopping")
animationTrack:Stop()
playing = false
end
wait()
end
Video:
If you need any more info about the script just ask.