Java Script: Ambiguous reference

Hi

I’m a beginner and I’m trying to write a simple code for jumping using AddForce, but I don’t understand what does this error mean:

Assets/Jumping.js(16,17): BCE0004: Ambiguous reference ‘rigidbody’: Jumping.rigidbody, UnityEngine.Component.rigidbody.

public var jumpPower : float;
private var rigidbody : Rigidbody2D = GetComponent(Rigidbody2D);

function Start()
{
	jumpPower = 50;


}

function Update()
{
	

	if(Input.GetKeyDown(KeyCode.Space))
	{
		rigidbody.AddForce(Vector3.up * 300);
	}
}

Unity used to have shortcut component accessors, one of which was called “rigidbody”, which was short for GetComponent(Rigidbody). Rename the “rigidbody” variable to something else. Also, it’s best not to attempt to run code outside functions; only declare variables. It should be:

private var myRigidbody : Rigidbody2D;

function Start() {
    myRigidbody = GetComponent(Rigidbody2D);
    ....