[HELP] how to fix this animation stutter?

don’t really know how to describe this but whenever i spam the movement button, in some instances the animation will reset and i don’t really know how to fix it

example:

code:

hum.Running:Connect(function(speed)
	if speed > 0 and speed < 18 and not anim.walk.IsPlaying then
		anim.idle:Stop()
		anim.walk:Play()
	elseif speed > 18 and not anim.run.IsPlaying then
		anim.run:Play(.5, 1)
		anim.walk:Stop(.75)
	elseif speed == 0 then
		anim.idle:Play()
		anim.walk:Stop(.25)
		anim.run:Stop(.25)
	end
	if speed < 18 and anim.run.IsPlaying then
		anim.walk:Play(.5, 1)
		anim.run:Stop(.75)
	end
end)

what i’m (trying) to achieve:

please let me know if there is any better way to code animation too! thanks

1 Like

For the walking and idle animations, I would recommend following this Roblox documentation page:

It has a section on replacing the default Roblox animations, which includes the idle, walk, and run.

Roblox most likely handles this smooth transition, so it should work.

1 Like