Double Jump (149105)

How can I make this script double jump instead of being able to hold to jump higher.

Edit: and also how do you make it to where my player does not roll over when he its a corner

C#

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour {

public GameObject Character;
public float jumpSpeed = 5f;
public float Speed = 5f;
public bool canControl;

void Update()
{
	if(canControl == true)
	{
		float h = Input.GetAxis("Horizontal") * Speed;
		
		Character.transform.Translate(h*Time.deltaTime,0,0);
	}

	if (Input.GetKey(KeyCode.W)) { 
		Jump ();
	}
}

void Jump(){ 
	GetComponent<Rigidbody>().AddForce(Vector3.up * jumpSpeed);	
	
} 

}

Use GetKeyDown instead. With your current code, it would mean that every time the player presses ‘w’, the character will jump. So essentially, the character can fly.

To correct this, you will need a way to detect of the character is on the ground, and then keep track of how many time he jumped. Then every time the character is on the ground again, you can reset the amount of times he jumped. There are quite some tutorials out there that will help you with this. Good luck!