Need help with GUI label not displaying variable

So I have a GUI label that I want to simply display the value of boxCount, however even when boxCount increments in the inspector (when I collect little boxes), The label stays at 0. Any help would be greatly appreciated!

//javascript

var boxCount : int;

function OnTriggerEnter (other : Collider) 
{
    other.gameObject.SetActive(false);
    boxCount = boxCount + 1;
}

function OnGUI()
{

   GUI.Label (Rect (100,100,50,50), boxCount.ToString(), "box");
}

ok nevermind all I had to do was put
var boxCount : int = 0;
and it worked :slight_smile: