Jumping and Falling anim when running

How would I prioritize the jumping and falling animation when im running?

-- local Players = game:GetService("Players")

--//Variables
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local RunAnimation = Humanoid:WaitForChild("Animator"):LoadAnimation(game.StarterPlayer.StarterCharacterScripts.Animate.run.RunAnim)

--//Controls
local MaxSpeed = 45
local animationPlaying = true

--//Functions
LocalPlayer.CharacterAdded:Connect(function(character)
	Humanoid = character:WaitForChild("Humanoid")
end)

LocalPlayer.CharacterRemoving:Connect(function()
	Humanoid = nil
end)

while true do
	if not Humanoid then
		continue
	end
	
	local timeElapsed = 0

	while Humanoid.MoveDirection.Magnitude > 0 do
		Humanoid.WalkSpeed = math.min(Humanoid.WalkSpeed + 0.75, MaxSpeed)
		
		if timeElapsed >= 1.5 and not animationPlaying then
			animationPlaying = true
			RunAnimation:Play()
		end

		task.wait(0.1)
		timeElapsed += 0.1
	end

	Humanoid.WalkSpeed = 5
	
	animationPlaying = false
	RunAnimation:Stop()

	task.wait()
end
1 Like

Hi,

Set the animation priority higher than the running animation.
Animation Priorities: AnimationPriority | Roblox Creator Documentation
How to change it in through scripting: How do I change an animation's priority from a script?

I tried it, and it did not work.

1 Like

If your running animations priority is lower than the falling & jumping animations priority, then it should work.