I have this script on my pickup ( a banana )
var targetObj : GameObject;
function OnTriggerEnter()
{
var bananacount = targetObj.GetComponent(bananacount);
bananacount.money++;
audio.Play();
Destroy(gameObject);
}
and this on my main char.
var moneydisp : GUIText;
var money : int;
function Update ()
{
moneydisp.text = "Bananas : " + money;
}
It's supposed to add one to the counter every time the trigger is entered, but in the banana script it won't let me add to the score using money++ or money = money + 1 at all, and i get an error of 'Expression Cannot be assigned to'. How can i get this to work 'right'?