Stop all animations from playing when not moving

Hey, I would like all animations to stop when the character is not moving at all. I have custom animations for every movement direction.

Anyways this is what I tried.

local AnimationTracks = character.Humanoid:GetPlayingAnimationTracks()

humanoid.StateChanged:Connect(function()
	if humanoid:GetState() ~= Enum.HumanoidStateType.Running then
		for i, track in pairs(AnimationTracks) do
			track:Stop()
		end
	end
end)
1 Like

Where there any errors at all and what happened?

1 Like

The animation keeps playing even though I am not moving at all.

Here’s a gyazo: https://gyazo.com/73e9551dadf49efe89cffc9461232b1a

1 Like

Strange, what I would do is take a look at this and simply change the idle animation to be want you want:

1 Like