Why does the bullet has wrong direction?

I have this script attached to a gun, that shoots a sphere(bullet) from an empty GameObject named “Spawner” in front of it.
The problem is that when I press the mouse button, the bullet has a wrong direction, as the image shows bellow. Why is this happening?


Preview:


This is the script that I use:

#pragma strict
var bulletPref : Rigidbody;
var bulletPos : Vector3;
var spawner : GameObject;

function Start () {

}

function Update () {
bulletPos = spawner.transform.position;
	if(Input.GetMouseButtonDown(0))
	{
		var clone : Rigidbody;
        clone = Instantiate(bulletPref, bulletPos, transform.rotation);
        clone.velocity = transform.TransformDirection (Vector3.forward * 20);
	}

}

The bullet should go in the forward direction of the object to which this script is attached (Pistol, I presume). If it’s being deviated, maybe the bullet collider is touching some other collider at the spawner position (the player, the pistol model etc.)- this would result in an altered trajectory.

NOTE: Usually, in a first person game the weapon is childed to the camera, so that the player shoots in the direction he’s looking at.