Cannot implicitly convert type `int' to `healthgui'

i am trying to make a command where: you press the space bar button and the health bar goes down by 10 health, but i am accessing this health variable from another script, i did everything the tutorial told me too and i keep getting this error message: Cannot implicitly convert type int' to healthgui’

this is my code where my health is located:

using UnityEngine;
using System.Collections;

public class healthgui : MonoBehaviour {
	//these floats are used to easily configure the GUI Image//

	//health image size and positioning floats//
	public float guiHealthWidth;
	public float guiHealthHeight;
	public float guiHealthDistLeft;
	public float guiHealthDistTop;


	public int health = 100;
	public GUIStyle healthbar;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void OnGUI () {

		//Displays health Hud//
	GUI.Box (new Rect(
			(Screen.width/16) * guiHealthDistLeft,
			(Screen.height/16) * guiHealthDistTop,
			(Screen.width/16) * guiHealthWidth,
			(Screen.height/16) * guiHealthHeight),
			 health.ToString(),healthbar);


	}

and this is where my health accessor is located:

using UnityEngine;
using System.Collections;

public class keyboard : MonoBehaviour {

	private healthgui heal;

	// Use this for initialization
	void awake () {
		heal = this.gameObject.GetComponent<healthgui>().health;
	
	}
	
	// Update is called once per frame
	void Update () {

		int newHealth;
		int gethealth;
		if (Input.GetKey(KeyCode.Space)) {

			gethealth = heal.health;
			newHealth = heal.health - 10;
			heal.health = newHealth;

				}

	
	}
}

In your class healthgui you have a field called health, this is of type int. In keyboard you have a field called “heal”, heal is of type healthgui. In awake you are getting the component for healthgui, then getting the value for the health field in that instance of healthgui. health is not of type healthgui which the field heal is. You need to remove the field health and just end it like:

heal = this.gameObject.GetComponent<healthgui>();

It seems you access the field health in the update method anyways, this should fix your issues.