Walking animation is jittering, is it because there's another walk animation playing over it?

Heyo,
The walking animations in my game are different from default Roblox’s. There are animations for walking backwards, sprinting, and walking forwards (replaces the default run animation).

To achieve this, I adjusted the animation script inside the avatar. The only part i modified so far was the onRunning function (found in the state change handlers), shown below:

function onRunning(speed)
	local movedDuringEmote =
		userEmoteToRunThresholdChange and currentlyPlayingEmote and Humanoid.MoveDirection == Vector3.new(0, 0, 0)
	local speedThreshold = movedDuringEmote and Humanoid.WalkSpeed or 0.75
	if speed > speedThreshold then
		if speed < 20 then
			local scale = 16.0
			if Humanoid.MoveDirection.X > 0 then
				if Character.HumanoidRootPart.CFrame.LookVector.X > 0 then
					playAnimation("walk", 0.2, Humanoid)
					pose = "Running"
				else
					playAnimation("walk", 0.2, Humanoid)
					pose = "BackWalk"
				end
			else
				if Character.HumanoidRootPart.CFrame.LookVector.X > 0 then
					playAnimation("walk", 0.2, Humanoid)
					pose = "BackWalk"
				else
					playAnimation("walk", 0.2, Humanoid)
					pose = "Running"
				end
			end
		else
			local scale = 16.0
			playAnimation("walk", 0.2, Humanoid)
			setAnimationSpeed(speed / scale)
			pose = "Sprinting"
		end
	else
		if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then
			playAnimation("idle", 0.2, Humanoid)
			pose = "Standing"
		end
	end
end

The Issue
For some reason, when the animations for walking backwards/sprinting plays, it jitters into the forward walking animation.

I assumed it was because the priority for the forward walking animation was too high, so I set it to Core, but it still happened.

Here’s what it looks like (the sprinting animation is a placeholder):

What can I do to get rid of this? Alternative approaches would help too.

2 Likes

Maybe deleting the default animation script every time the player spawns is a solution?

The default animation script is already deleted before the new one is put in

Nevermind, I’ve solved it on my own

Would you please share what you did so anyone else having same problem will benefit from your work.

1 Like

The issue was that I didn’t change the playAnimation parameters to play my custom animations
This part of the code works compared to the original post

            if Humanoid.MoveDirection.X > 0 then
				if Character.HumanoidRootPart.CFrame.LookVector.X > 0 then
					playAnimation("walk", 0.2, Humanoid)
					pose = "Running"
				else
					playAnimation("backwalk", 0.2, Humanoid)
					pose = "BackWalk"
				end
			else
				if Character.HumanoidRootPart.CFrame.LookVector.X > 0 then
					playAnimation("backwalk", 0.2, Humanoid)
					pose = "BackWalk"
				else
					playAnimation("walk", 0.2, Humanoid)
					pose = "Running"
				end
			end
1 Like