Walking Animation Playing When Not Supposed To

  1. What do you want to achieve?

Simple Custom Jump, Walk, and Idle Animations.

  1. What is the issue?

Walk is playing after the player jumps, when really idle should be depending on movement.

https://gyazo.com/980e31ac212a13752386babd0868d80f

  1. What solutions have you tried so far?

Tried fixing around Animation Priorities but it doesn’t change anything. Also tried adding another way of walkAnimTrack:Stop() but then it breaks the other ways of playing it.


Code -

Everything seems to work, but for some reason the WALK animation is playing after a player jumps?

7 Likes

I believe the problem may be where the code is as shown.

Humanoid.Jumping

When you do that you play the jump animation without checking to stop any other animations. Try adding a line where it stops the walk animation once the humanoid jumps

2 Likes

After I do this -

humanoid.Jumping:Connect(function()
	walkAnimTrack:Stop()
	jumpAnimTrack:Play()
end)

It decides to break all the walking and idle animations? Like it will stop the walking animation. So only jump animation works after one jump.

I think your issue here is that you expect walkAnimTrack to play again after you’re done. Have the track play again once you finish the jump. If you want to go out the easy way just go:

humanoid.Jumping:Connect(function()
   walkAnimTrack:Stop()
   jumpAnimTrack:Play()
   wait(x) --completely customizable, recommend to either time it off how long youre in air or length of anim
   jumpAnimTrack:Stop() --this is here to ensure there wont be any more runs of the jump anim
   walkAnimTrack:Play()
end)

:smile:

1 Like

If tried adding this, and still tends to play the walkAnimTrack when the player just jumps?

What is causing this still?

To anyone who has had this problem,

I found the solution.


Using my brain, I finally was able to figure out that the ‘‘Humanoid.Running’’ was the problem this whole time.

Here is the fix!

local RunService = game:GetService("RunService")

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

local jumpSound = script:WaitForChild("JumpSound")

local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)
walkAnimTrack.Priority = Enum.AnimationPriority.Movement

local idleAnim = script:WaitForChild("Idle")
local idleAnimTrack = humanoid.Animator:LoadAnimation(idleAnim)
idleAnimTrack.Priority = Enum.AnimationPriority.Idle

local jumpAnim = script:WaitForChild("Jump")
local jumpAnimTrack = humanoid.Animator:LoadAnimation(jumpAnim)
jumpAnimTrack.Priority = Enum.AnimationPriority.Action

idleAnimTrack:Play()

local function move()
   
   if humanoid.MoveDirection.Magnitude > 0 then
   	if not walkAnimTrack.IsPlaying and idleAnimTrack.IsPlaying then
   		idleAnimTrack:Stop()
   		walkAnimTrack:Play()
   	end
   else
   	if walkAnimTrack.IsPlaying and not idleAnimTrack.IsPlaying then
   		idleAnimTrack:Play()
   		walkAnimTrack:Stop()
   	end
   end
   
   if humanoid.Jump then
   	jumpAnimTrack:Play()
   	jumpSound:Play()
   end
   
end


RunService.RenderStepped:Connect(move)

I decided to use RunService, and humanoid.MoveDirection. This prevents the walking, animation from getting confused. I figured speed was like just when a player moves at all. This helps clarify that jumping, and moving back and forth are two different things.

The end. Hell yes.

9 Likes

Thanks Mate! Thats helped me alot