jump animation only plays for about 1/10 of a second unless the button is pressed twice

I just started learning how to use Unity. I’m working on a 2D platformer using tutorial videos from the youtube channel “Brackeys”. My method is to go through one video, following his instructions to a T, and repeating that same video through multiple iterations before moving on to the next video. For a reason that i cant figure out, one of my iterations wont properly play the jumping animation.

In the animation preview window it looks perfectly fine, but when doing a test run the animation will only play for a split second before reverting back to the animation before it (either run or idle). Although it will play all the way through if I press the button twice. When looking at the parameters tab in the animation window, I can see the “IsJumping” parameter is activated for that split second when i press the jump button but then it unchecks immediately after. The weirdest part is that I’ve checked about five times and as far as I can see everything is exactly the same between the iteration that doesnt work and the one that does. Any help or advice would be greatly appreciated!

Here is the movement script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Playermovement : MonoBehaviour {

 public CharacterController2D controller;
 public Animator animator;

 public float runSpeed = 40f;

 float horizontalMove = 0f;
 bool jump = false;
 bool crouch = false;

 // Update is called once per frame
 void Update() {

     horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;

     animator.SetFloat("Speed", Mathf.Abs(horizontalMove));
     
     if (Input.GetButtonDown("Jump"))
     {
         jump = true;
         animator.SetBool("IsJumping", true);
     }

     if (Input.GetButtonDown("Crouch"))
 {
        crouch = true;
 } else if (Input.GetButtonUp("Crouch"))
 {
     crouch = false;
 }

  }

 public void OnLanding()
 {
     animator.SetBool("IsJumping", false);
 }

public void OnCrouching (bool isCrouching)
{
    animator.SetBool("IsCrouching", isCrouching);
}
 void FixedUpdate ()
{
    // Move our character
    controller.Move(horizontalMove * Time.fixedDeltaTime, crouch, jump);
    jump = false;
   }

}

Did u solve ur problem yet because i kinda have the same problem as yours