Broken Script Help

Hello I'm a little new to Unity im trying to make my first Unity based project but the console says "No appropriate version of 'UnityEngine.Rigidbody.AddForce' for the argument list '(float)' was found." I'm just trying to add force to my bullet to make it actually shoot. Here script:

function Update(){
if(Input.GetKeyDown("space")){
    Instantiate(bullet, GameObject.Find("Bullet Spawn").transform.position, Quaternion.identity);
    bullet.rigidbody.AddForce(transform.position.z * 2000);
    print("shot");
}

}

Thanks!

No appropriate version of 'UnityEngine.Rigidbody.AddForce' for the argument list '(float)' was found.

bullet.rigidbody.AddForce(transform.position.z * 2000);

You are accessing the z component of position, which is a float value. I guess what you really want to do is get the forward direction of the transform. Also, you're trying to add the force to what looks to be the prefab. You should add the force to the new clone you instantiated.

var power = 2000;
var position = GameObject.Find("Bullet Spawn").transform.position;
var clone = Instantiate(bullet, position, Quaternion.identity);
clone.rigidbody.AddForce(transform.forward * power);

However, you might want to use another force mode since you're "shooting" the object away. Impulse force mode sounds appropriate.

This mode is useful for applying forces that happen instantly, such as forces from explosions or collisions.

var power = 2000;
var position = GameObject.Find("Bullet Spawn").transform.position;
var clone = Instantiate(bullet, position, Quaternion.identity);
clone.rigidbody.AddForce(transform.forward * power, ForceMode.Impulse);

You probably want to tweak power a bit. 2000 sounds a lot.