DoubleJump

I am trying to write a double jump script similar to my teachers and one that also works with the movement script we have. However, I can get the player to read out 2 jumps when it hits the platform but it wont decrament or anything else… I just started scripting a month or so ago and I would appreciate the help!! Thanks!!

public class Player : MonoBehaviour
{
public float Speed = 7.0f;
public float jumpSpeed = 7.0f;
public int jumpCount = 2;
Vector3 Move;
public bool doubleJump;
public bool isGrounded;
void Update()
{
Move = new Vector3 (Input.GetAxis (“Horizontal”), Input.GetAxis (“Vertical”), 0);
transform.position += Move * Speed * Time.deltaTime;

	if (Input.GetKeyDown (KeyCode.Space)) {
		GetComponent<Rigidbody> ().velocity += Vector3.up * jumpSpeed;
	}
}

	void OnCollisionEnter(Collision col)
	{

	if (col.gameObject.name == "Platforms")
	{
		isGrounded = true;
		jumpCount = 2;
		jumpSpeed = 7;
	}


	if (Input.GetKeyDown (KeyCode.Space) && jumpCount > 0)
	{
		jumpCount--;
		doubleJump = true;
		isGrounded = false;
	} 
	if (Input.GetKeyDown(KeyCode.Space) && jumpCount <= 0)
	{
		doubleJump = false;
		jumpSpeed = 0;
		isGrounded = false;
	}

	Debug.Log (jumpCount);

	}

}

You shouldn’t be checking the Input in OnCollisionXXX methods. It is most reliable in Update.

If you try to get the Input in OnCollisionEnter you have to hit the key in a specific moment before the OnCollisionEnter method is called (if it isn’t already cleared by then).