How to change and play a different animation if a player is mid air?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? To change and play a different animation if a player is in the air

  2. What is the issue? Don’t know how to change and play the different animation correctly

  3. What solutions have you tried so far? everything lol

pls help:
‘’‘local Track = Instance.new(“Animation”)
Track.AnimationId = “rbxassetid://5864697364”
local Anim = c.Humanoid:LoadAnimation(Track)
character;WaitForChild(“Humanoid”).StateChanged:Connect(function(OldState,NewState)
if NewState == Enum.HumanoidStateType.Freefall then
Track.AnimationId = “rbxassetid://5816453806”
Anim:Play()
end
end)’‘’

 local Players = game:GetService("Players")
 local function onCharacterAdded(character)
 local humanoid = character:WaitForChild("Humanoid")
 for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
 playingTracks:Stop(0)
 end
 local animateScript = character:WaitForChild("Animate")

animateScript.fall.FallAnim.AnimationId = "rbxassetid:// asset id here" -- Fall

end
local function onPlayerAdded(player)
player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
end
 Players.PlayerAdded:Connect(onPlayerAdded)

this will play the animation during the falling state, but if you want to change it you would have to later on have to

characater.Humanoid.StateChanged:Connect(function(old,new)
if new == End.HumanoidStateType.Freefall then
local animateScript = character:WaitForChild("Animate")

animateScript.fall.FallAnim.AnimationId = "rbxassetid:// new asset id here" -- Fall
 end
 end
 end)

this is where I got it from

yea I’m just using the code from this at the section “Changing a Default animation”