var currentScore : int = 0;
var addScore : int = 10;
var finalScore : int = 0;
function OnTriggerEnter(collision : Collider){
if(collision.gameObject.tag == "TimeCapsule"){
Counter();
Destroy(collision.gameObject);
}
function Counter(){
currentScore += addScore;
finalScore = currentScore;
}
the final score is always 10 even when it collects the object
You are disabling the collision after they hit, so the final score will never be more than 10 since you are not allowing it to be hit again. Since you are not doing anything with final score, why not just remove it since your example is just increasing the final score total but it’s always going to be the same as your current score. Unless your final score is suppose to be updated multiple times then you would need to stick your final score variable into another script and access it.