RaycastHit hit;
if (Physics.Raycast(transform.position, Vector3.down, out hit, 1.01f)); {
canJump = true;
}
if(canJump && Input.GetKeyDown("space")) {
canJump = false;
GetComponent<Rigidbody> ().AddForce (0, jumpingForce, 0);
}
}
}
Add a small delay before you check for being grounded again after a jump: what is likely happening is the frame after you press jump your canJump variable is being set to true again because your character hasn’t moved far enough to clear the raycast check. You can also add an else statement to the raycast that says to set canJump to false if there is no ground under you.