Bullet still goes sideways...

I maded a script but still it doesn’t work can someone help me please?

Here’s the script:

var BulletPrefab:Transform; var force
: float = 2000;

function Update() {
if(Input.GetButtonDown(“Fire1”)) { var
bullet = Instantiate(BulletPrefab,

GameObject.Find(“Barrel”).transform.position,

GameObject.Find(“Revolver”).transform.rotation);

bullet.rigidbody.AddForce(transform.forward

  • force);

} }

You’re using transform.forward as the force direction. The bullet will fly in the direction that the object that holds this script is facing, as opposed to the direction your revolver is facing.

What happens when you use:

bullet.rigidbody.AddForce(GameObject.Find("Revolver").transform.forward * force);

P.S. are you sure you don’t want to use hitscan for a revolver? They move pretty fast.