Animation Walking Problem

You aren’t quite there yet. You’ll need to start and stop the animation while the Humanoid is moving. But that isn’t part of your original code.

put animation into script, change npc = script.Parent

well i searched up how to make a npc play a animation while moving, looks like that was the outcome.

You’ll want to hook the Running event in the humanoid. See Humanoid | Roblox Creator Documentation

Starting from my code:

local npc = script.Parent
local animation = npc:WaitForChild("Animation")
local model = npc:LoadAnimation(animation)
model:Play()

You can do something like this:

local npc = script.Parent
local animation = npc:WaitForChild("Animation")
local animation_track = npc:LoadAnimation(animation)

local playing = false

npc.Running:Connect(function(speed)
	if (speed > 0) then
		if (not playing) then
			animation_track:Play()
			playing = true
		end
	else
		if (playing) then
			animation_track:Stop()
			playing = false
		end
	end
end)

1 Like

Thank you so much! i apreaciate this. i hope you have a wonderfull and blessed day.

1 Like

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