Jump script not working

Basically I’ve attached a script to my 2d sprite so whenever I press the spacebar it jumps, but cannot jump in mid-air and must be touching the ground (another object with a 2d collider) but the sprite doesn’t jump when I press the spacebar (although it does land on the ground). Here’s the script:

public class jellyscipt : MonoBehaviour {
	public Vector2 jumpSpee = new Vector2(0, 20);
	public float jumpSpeed = 20f;
	public bool isGrounded=false;

	// Use this for initialization
	void Start () {

	// Update is called once per frame
	void Update () {
		if (Input.GetKey (KeyCode.Space) && isGrounded == true)
						transform.Translate (0f, jumpSpeed * Time.deltaTime, 0f);
	void OnTriggerEnter2D(Collider2D other){
				if (other.gameObject.name == "tilegrass") {
						isGrounded = true;
	void OnTriggerExit2D(Collider2D other){
				isGrounded = false;


I’m not sure what’s wrong. Any help would be really appreciated, and even a more efficient alternative code would be welcome.

Does your ground object have the tag tilegrass? It has to have it as you are checking for it.

If so, are you initiating the game with your player above the ground so it can trigger the OnTriggerEnter2D() method for the first time?

These seem to be the only possible errors to me.