The code is supposed to instantiate the product when the player clicks and there’s enought gold, then remove some gold. (I’m a novice programer)
var Gold:int;
var product : Rigidbody;
function Update () {
Gold = 15;
if (Input.GetButtonDown("Fire1") && Gold > 10) {
Instantiate(product, transform.position, transform.rotation);
Gold--;
}
}