I ADDED THE GETCOMPONENT(PickUpGUI) INSIDE THE IF STATEMENT AND THIS ERROR CAME UP AND IM STUMPED CAUSE EVERYTHING LOOKS IN ORDER. WHAT AM I MISSING?
**PickUpGUI is another Script that im enabling on n off to display a pick up message.
function Update ()
{
if (thePlayer != null)
{
dist = Vector3.Distance(thePlayer.position, transform.position);
if (dist <= PickUpDistance)
{
GameObject.Find.tag == ("Health").GetComponent(PickUpGUI).enabled=true;
}
else
{
GameObject.Find.tag == ("Health").GetComponent(PickUpGUI).enabled=false;
}
//ERROR ON THIS LINE.
if (Input.GetKeyDown(ButtonToPress) && GetComponent(PickUpGUI).enabled=true)
{
theItem.PickUpItem();
}
}
}