How can i solve this error?because i am doing the right things

#pragma strict
var health : float = 100.0;
var hunger : float = 100.0;

function Start () {

}

function Update () {

hunger -= Time.deltaTime/3;

if (hunger <=5){
    
    health --;

}

if (health <=0){

    print ("Moriste!");
    
    }
 
 health = Mathf.(lamp(health, 0.0, 100.0);   
 hunger = Mathf.(lamp(hunger, 0.0, 100.0);   
         
}

function OntriggerEnter (other : Collider) {

if (other.gameObject.name == ("Banana")&& hunger <=90.0){

health += 10;
Destroy (other.gameObject.transform.parent.gameObject);

   }

}

There are a few problems with the script:

health = Mathf.(lamp(health, 0.0, 100.0);
hunger = Mathf.(lamp(hunger, 0.0, 100.0); 

Replace (lamp with Clamp…

health = Mathf.Clamp(health, 0.0, 100.0);
hunger = Mathf.Clamp(hunger, 0.0, 100.0); 

Next one is the function name, it is case sensitive:

function OntriggerEnter (other : Collider)

should be:

function OnTriggerEnter (other : Collider)

And third:

Destroy(other.gameObject.transform.parent.gameObject);

This is not really an error, but it included an unnecessary step

Destroy(other.transform.parent.gameObject);

There’s another problem though, which you should fix yourself: your health will get reduced to 0 very fast because of this little piece:

if (hunger <= 5)
{
	health--;
}

Look at what you did with hunger, and do the same to health (hint: deltaTime)


The end result:

#pragma strict

var health : float = 100.0;
var hunger : float = 100.0;

function Start()
{

}

function Update()
{
	hunger -= Time.deltaTime * 0.33;

	if (hunger <= 5)
	{
		health--;
	}

	if (health <= 0)
	{
		print("Moriste!");
	}

	health = Mathf.Clamp(health, 0.0, 100.0);
	hunger = Mathf.Clamp(hunger, 0.0, 100.0);
}

function OnTriggerEnter(other : Collider)
{
	if (other.gameObject.name == "Banana" && hunger <= 90.0)
	{
		health += 10;
		Destroy(other.transform.parent.gameObject);
	}
}

trying adding the “C” to your mathf.lamp statements…
you have …

     health = Mathf.(lamp(health, 0.0, 100.0);
    hunger = Mathf.(lamp(hunger, 0.0, 100.0); 

when you should have…

 health = Mathf.Clamp(health, 0.0, 100.0);
hunger = Mathf.Clamp(hunger, 0.0, 100.0); 

hope that helps bud

take care
Gruffy