Variable jumping doesn't work on second jump.

I have a project where the character can double jump. Today, I started adding code so variable jumping (the longer you hold down the up button, the higher he jumps) would work, and it works great, except for the fact that it doesn’t work at all on the second jump of the double jump. Here’s my code:

function jump() {
    if (unlockables.doubleJumpUnlocked == false) {
    if (unlockables.doubleJumpUnlocked == true) {
        if ((jumpOverride == false) && (jumps < 2)) {
            if (Input.GetKeyDown("up")) {
            	this.GetComponent.<Rigidbody2D>().AddForce(Vector2.up * jumpHeight);
                jumping = true;
                groundCheck.grounded = false;
                jumps += 1;
                jumpCount = 0;
                Debug.Log("something else");
            if ((Input.GetKey("up")) && (jumpCount < 10)) {
                this.GetComponent.<Rigidbody2D>().AddForce(Vector2.up * 15); 
                jumpCount += 1;
                Debug.Log("did something" + jumpCount);

A bit of background on the variables, if it helps:

  • “jumping” checks if I’m jumping
  • “jumps” counts the amount of jumps
  • “jumpCount” counts the amount of mini jumps inside the jumps that make up the variable jumping.
  • “jumpOverride” is a manual override to stop jumps, but i don’t think that matters here.

Thank you so much for your time, and I’m sorry for the messy code. It’s probably some logic error I’m not seeing, but I’ve been messing this for 45 minutes, without any progress.

I’m not 100% sure on this one but don’t you need to reset your jumps and jumpCount variables?