Calling a function from another script issue

Here’s the error I’ve been getting:

Assets/newstuff/Scripts/Player.js(64,32): BCE0017: The best overload for the method
‘Heal.HealHp(Item)’ is not compatible with the argument list ‘()’.

I’ve looked all around the forum for a solution and none that I’ve found have worked.
Any ideas? An explanation would be great too, thank you :slight_smile:

Player Script that references the script:

   function UseItem(i:Item,slot:int,autoequip:boolean){
    	if(i.isPotion){
    		if(autoequip){
    		findHeal = GameObject.FindWithTag("potion").GetComponent(Heal);
    		findHeal.HealHp();
    		}
    	}
    }

and the Heal script being referenced:

var healAmount:int;
var maxHealth=400;
var curHealth=50;
var health=curHealth;

function HealHp(i:Item){
	if(i.isPotion){
		health=curHealth+healAmount;
			Destroy(this.GameObject);
			Debug.Log("Your health is now "+health+" 1 potion has been removed from inventory");
	}
}

Your function HealHp needs one argument i. In your function UseItem you call HealHp without argument, you need to add an item in it. You should have :

findHeal.HealHp(i);

instead of :

findHeal.HealHp();