Issues using GetComponent

I’m have a boolean variable called ‘shieldOn’. I’m trying to access a function that sets the boolean to false using GetComponent from another script and for the life of me I can’t.

I get this error

UnityException: You are not allowed to call this function when declaring a
variable. Move it to the line after without a variable declaration.

I pretty much copied the example right from the api reference to GetComponent and have no clue why it’s doing this. Here’s the link:
API: GameObject.GetComponent

Here’s my code for scriptShield

function Update () 
{
	if(shieldStrength <= 0)
	{
		Destroy(gameObject);
		//The line below works fine but I want to access the function instead
//		scriptPlayer.shieldOn = false;	
        //Line below is almost identical example that is given by unity
		var other : scriptPlayer = gameObject.GetComponent(scriptPlayer);
		other.SetShieldFalse();
	}	

}

Here’s the function in for the shield in the script ‘scriptPlayer’

static var shieldOn	: boolean = false;


function SetShieldFalse()
{
	shieldOn = false;
}

It works perfectly if I set the variable ‘shieldOn’ to static and access it from the scriptShield but I want to learn how to use the GetComponent function properlly because I’ll need it when I want to access other functions that control non static variables…
Help is greatly appreciated.

Don’t forget the parens after the GetComponent

http://unity3d.com/learn/tutorials/modules/beginner/scripting/getcomponent

Search UA/Google for many other examples, tuts/vids, code snippets, etc on using GetComponent, it’s the most frequently asked question.