How to fix this R6 walk animation bug

You’ve probably come to the point, where you “jump while moving in the air” and stop at the last millisecond moving while fully landed, and encounter this animation bug that only occours on R6:

Now the question:

How do we fix this bug?

After investigating the Animate localscript (That’s always inside your character when you load in by default btw) and while searching for the problem, I’ve found a solution.

First of all, test the game, and copy the ‘Animate’ localscript, that’s inside your player character.
Then be sure to paste it inside the StarterPlayer → StarterCharacterScripts, in the way, that the game can’t place the default Animate script when you run the game, allowing you to edit it in studio.

The code at line 347 (inside the Animate localscript) has the onRunning function, which is meant to animate your player character (the walking / running animation for your character).

Now taking a look at the code, you’ll see:

function onRunning(speed)
 	if speed > 0.01 then
 		playAnimation("walk", 0.1, Humanoid)
 		if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
 			setAnimationSpeed(speed / 14.5)
 		end
 		pose = "Running"
 	else
 		if emoteNames[currentAnim] == nil then
 			playAnimation("idle", 0.1, Humanoid)
 			pose = "Standing"
 		end
 	end
 end

Now, the problem is that the code works with the Humanoid.Running property, which was I guess ‘an old way to check if the player is running’, but we should use the ‘advanced’ code to check, if a player is walking / running, which is by working with the .MoveDirection property, and then using .Magnitude, to check the distance between the humanoid’s MoveDirection, and if it’s bigger than 0, then we indeed know, that the player character is moving.

Code: Humanoid.MoveDirection.Magnitude > 0

So what we do is we’ll just replace at line 347 (inside the Animate script):

This unedited code:

 function onRunning(speed)
 	if speed > 0.01 then
 		playAnimation("walk", 0.1, Humanoid)
 		if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
 			setAnimationSpeed(speed / 14.5)
 		end
 		pose = "Running"
 	else
 		if emoteNames[currentAnim] == nil then
 			playAnimation("idle", 0.1, Humanoid)
 			pose = "Standing"
 		end
 	end
 end

To this edited code:

 function onRunning(speed)
 	if Humanoid.MoveDirection.Magnitude > 0 then
 		playAnimation("walk", 0.1, Humanoid)
 		if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
 			setAnimationSpeed(speed / 14.5)
 		end
 		pose = "Running"
 	else
 		if emoteNames[currentAnim] == nil then
 			playAnimation("idle", 0.1, Humanoid)
 			pose = "Standing"
 		end
 	end
 end

And awesome!, our problem is solved. The issue was simply the Humanoid.Running ‘speed > 0.01’ part, which once again, is a bad way to measure, if the player is now walking / running or not.

This was my first post btw, apologies, if It’s not that good ‘decorated’.

14 Likes

This should go in the community tutorials section, not so much the code review/help and feedback tag.

#resources:community-tutorials

1 Like

from my experience, I am pretty sure that’s just due to roblox’s animation interpolation, since the jumping animation sends the arm so high, it only knows a forward path to put it back into place, and so it goes backwards, and the “fling” is moreso the cramped fadeout timing for the animations. An easy fix is to probably rotate the arm down a bit (it’s really easy to get roblox’s animations trust me) or just make a custom animation set

1 Like