script connection

I have two JavaScript files one for a main building in my rts and one for a control point. I have managed to get them to some what communicate but the GUI in my control point script gets messed up, how can I fix this? I am still relatively new to scripting so be gentle. Thanks in advance

main building script-

//MainBuildScript


var curMoney : float;
var mob1 : GameObject;
var theLocation : Transform;
var check : int = 1;
var conCheck : int;
var loop : boolean = true;


var go = GameObject.Find("controlPoint");


function Update ()
{
	curMoney = go.GetComponent(controlPointScript2).curRes;
	
	conCheck = go.GetComponent(controlPointScript2).checkMe;
	
	if(check > 1)
    {
    	check = 1;
    }
}


function OnGUI()
{
	
		
		GUI.Label(Rect (10, 10, 100, 20), "Main");
		
	 	if (GUI.Button(Rect(10,30,80,30), "Worker"))
	 	{
	 		if(curMoney >= 5.0)
	 		{
	 			loop = true;
	 			
	 			mob1.SetActiveRecursively(true);
	 			Instantiate (mob1 , theLocation.position, transform.rotation);
	 			mob1.SetActiveRecursively(false);
	 			
	 			subtractFive();
	 			

	 		}
	 	}
	 	
	
}

function subtractFive ()
{
	if(loop) 
	{
		//Subtract Money
        check = 2;
        loop = false;
    }
	
}

Control Point Script -

var curRes : float = 0;
var timer : float;

var go2 = GameObject.Find("testMainBuilding");

var checkMe : int;

function Update ()
{
	checkMe = go2.GetComponent(mainBuildScript).check;
	
	if(curRes > 1000)
	{
		curRes = 1000;
	}
	
	if(checkMe >= 2)
    {
      	curRes = curRes - 5.0;	
    }
    if(curRes <= 0)
    {
    	curRes = 0;
    }
}

function OnCollisionStay (thing : Collision)
{

	
	timer += Time.deltaTime;
	
	if(thing.gameObject.tag == "control")
    {
    	if(timer >= 5)
    	{
      		curRes = curRes + 5.0;
      		timer = 0;
      	}
      	
	}


}

function OnGUI()
{
		GUI.Label (Rect (110, 10, 100, 20), "Resources: " + curRes);	
}

You can’t declare a variable and assign GameObject.Find(…) to it in the same line (as well as many other Unity functions or properties). Furthermore, the code outside any function is executed at Awake, when the object you’re trying to find may not exist yet.

To avoid these problems, you should just first declare the variable, then assign Find at Start():

...
var go: GameObject; // declare the variable first...

function Start(){
  // and find the object at Start():
  go = GameObject.Find("controlPoint");
}

The same applies to the second script.