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