My movement script is kind of broken for jumping (upward force is diminished after first jump)

This script I’m using on a Rigidbody object is KIND OF working. My first jump is pretty high, and all subsequent jumps are about 1/8th the force. What gives?

#pragma strict

var speed : float;
var grounded : boolean = true;

function Update () {
  var moveHorizontal : float = Input.GetAxis("Horizontal");
  var moveVertical : float = Input.GetAxis("Vertical");
  var moveUp : float;
  if (Input.GetKeyDown("space") && grounded == true) {
    moveUp = 20;
    grounded = false;
  var movement : Vector3 = Vector3(moveHorizontal, moveUp, moveVertical);
  rigidbody.AddForce(movement * speed * Time.deltaTime);

function OnCollisionStay(collisionInfo : Collision) {
  grounded = true;

Only physics functions should be done in FixedUpdate(), keypresses and other stuff should be done in in Update(). So when Space is pressed in Update(), it will change moveUp to 20, then when FixedUpdate() happens, it will operate based on those new values.

As for the double jump, did you switch to OnCollisionEnter?

Using Raycasts, or OverlapArea below your character, is a more consistent way to check if grounded though, simply disabling the check for a tiny bit after you hit jump.