Access int from other script (JS)

HI! I am making a game where you go around the world and pick up little pieces of iron or other minerals and they add to your score. I am using this script to display the score:


import UnityEngine.UI;

public static var OverallScore : int;        // The player's score.

private var text : Text;       // Reference to the Text component.

function Awake ()
    // Set up the reference.
    text = GetComponent (Text);

function Update ()
    // Set the displayed text to be the word "Score" followed by the score value.
    text.text = "Score: " + OverallScore;

Here is the script for picking it up:


var amount : int;
var ScoreManager : score;

function OnMouseDown () {
	ScoreManager.score.OverallScore += amount;

the UI text’s name is ScoreManager BTW.

I don’t get an error until I click on the ore. then I get this:

NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetProperty (System.Object target, System.String name)
UnityScript.Lang.UnityRuntimeServices.GetProperty (System.Object target, System.String name)
PickUpOre.OnMouseDown () (at Assets/PickUpOre.js:5)
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)

Please can you help me fix this?

the code is incomplete since this line is referencing things I can’t find

ScoreManager.score.OverallScore += amount;

but since OverallScore is static this should work:

ScoreManager.OverallScore += amount;