hi everyone, im trying to make, when an enemy dies you get 100 points and it updates the gui, so every kill you get 100 and it ads up. but i get this error It is not possible to invoke an expression of type ‘int’.
here is my script.
static var pointscollected = 0;
var moneyGUI : GUIText;
var amountPoints = 100;
function update () {
if(CharacterDamage.Addpoints == true){
pointscollected += amountPoints;
moneyGUI.text = pointscollected();
}
}
moneyGUI.text = pointscollected();
You are calling “pointscollected” as though it’s a method, but it’s just an integer.
It looks like the trouble is when you are trying to display the integer pointscollectedas a string text, since pointscollected is not text, and just a variable you need to convert it to text before you can display it. So this line…
moneyGUI.text = pointscollected();
Should probably be more like
moneyGUI.text = pointscollected.toString();
haha pakfront, you’re stealing my fire!