Instantiate but no force has been added

NullReferenceException: Object reference not set to an instance of an object

and this is the code

public Rigidbody bullet;
public Transform spawn;
public Transform spawn2;
	if(Input.GetMouseButton(0) && animation.IsPlaying("idel2aim")){
		Fire = true;
		Rigidbody bullet2;
		Rigidbody bulletcreate;
		bulletcreate = Instantiate(bullet, spawn.transform.position, transform.rotation) as Rigidbody;
		bullet2 = Instantiate(bullet, spawn2.transform.position, transform.rotation) as Rigidbody;
		bulletcreate.velocity = transform.TransformDirection(Vector3.forward * 90);
		bullet2.rigidbody.AddForce(transform.forward * 60000 *50);
	}

tried Velocity and rigidbody

From what I can see You have created a rigidbody called bullet but you are treating them like transforms.

I suggest changing “bullet”, “bullet2” and “bulletCreate” into Transform.

Also on the last line you call “BulletCreate.rigidbody”. This is wrong considering it is already a rigidbody. If you want to keep them rigidbody’s (not the best idea) remove the “.rigidbody.”.

I still think you should change them to Transforms like so:

public Transform bullet;
public Transform spawn;
public Transform spawn2;

    if(Input.GetMouseButton(0) && animation.IsPlaying("idel2aim")){
       Fire = true;
       Transform bullet2;
       Transform bulletcreate;
       bulletcreate = Instantiate(bullet, spawn.transform.position, transform.rotation) as Rigidbody;
       bullet2 = Instantiate(bullet, spawn2.transform.position, transform.rotation) as Rigidbody;
       bulletcreate.velocity = transform.TransformDirection(Vector3.forward * 90);
       bullet2.rigidbody.AddForce(transform.forward * 60000 *50);
    }