Run animation stopped after jumping

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to make a sprinting system. I want the running animation continues after you jump

  2. What is the issue? Include screenshots / videos if possible!
    Whenever you land after jumping, the running animation cancels and plays the walking animation instead. Here’s the video:

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried using Humanoid.StateChanged, but it wont play the running animation after landing

Here’s the sprint script i’m using:

uis.InputBegan:connect(function(key, gameprocessed)
	if key.KeyCode == Enum.KeyCode.LeftShift and humanoid.MoveDirection.Magnitude > 0 and gameprocessed == false and canRun.Value == true then
		humanoid.WalkSpeed = 25
		sprinting = true

		if humanoid.Health <= 50 then
			hurtrun:Play(0.25)
		else
			animrun:Play(0.25)
		end
		
		humanoid.StateChanged:connect(function(_, state)
			if state == Enum.HumanoidStateType.Landed then
				animrun:Play()			
			end
		end)
			
		while power.Value > 0 and sprinting do
			power.Value = power.Value - 0.015
			bar.Size = UDim2.new(power.Value / 10, 0, 1, 0)
			text.Text = math.floor(10 * power.Value).."%"
			tween:Play()
			task.wait()

			if power.Value <= 0 then
				humanoid.WalkSpeed = 16
				tween2:Play()
				animrun:Stop(0.1)
				hurtrun:Stop(0.1)
			end
		end
		
		if power.Value > 10 then
			power.Value = 10
		elseif power.Value < 0 then
			power.Value = 0.01
		end
		
	end
end)
2 Likes

Try making your walk animation and jumping animation priority movement. Then make the run’s priority action.

1 Like

The jumping animation doesn’t play now

Ah. Well in that case trying making the the jump animation action.

I’ve managed to fix the problem, i used Enum.HumanoidStateType.Jumping and then play the jump animation using the :LoadAnimation(). Thank you for trying to help!

try changing the animations in da animate instead of loading animations