How to make my jump script stop applying force every frame?

I have been loosely following a tutorial and I have edited a jump script to use the vertical axis to jump rather than the space bar. Problem is, when I hold “W” down, the character jumps through the roof because it keeps applying the jump force. This is because it is in the Update function. Here is part of the script:

void Update () {
	targetSpeed = Input.GetAxisRaw("Horizontal") * speed;
	currentSpeed = IncrementTowards(currentSpeed, targetSpeed,acceleration);
	if (playerPhysics.grounded) {
		amountToMove.y = 0;
		jumpSpeedy = Input.GetAxisRaw ("Vertical") * (jumpHeight);
		amountToMove.y = jumpSpeedy;

Is there a way I can make the jump force be applied only once per jump?


You shoud type isGrounded, NOT just “grounded”