How Do I Make A Player Jump Without The Player Flying If You Hold The Button (Im UsingC#)

I Need A Cooldown Effect For The Space Button

So The Player Cant Press it For 2 Seconds After

if (Input.GetKey("space"))
        {
            GetComponent<Rigidbody>().AddForce(new Vector3(0, 1, 0), ForceMode.VelocityChange);
        }
        else {
            GetComponent<Rigidbody>().AddForce(new Vector3(0, -1, 0), ForceMode.VelocityChange);
        }
       

       
    }
}

When I Press Space I Can Hold The Button And Fly!

use getkeydown instead of getkey? i’m not sure about the way you’re using forces to jump but i know very little about coding platformers and whatnot

It Worked partially But Now I Need A Cooldown For the Button But I Can No Longer Fly By Holding It Down

But I Can DoubleJump,TripleJump,etc

from google: Adding cooldown C# - Questions & Answers - Unity Discussions

Or check to see if the character is standing on an object they can jump off of

Thanks!