Error with transforming poisitons from local world

Help

This bit of code keeps spawning the game objects couple hundred units away. What am I doing wrong?

function FireShot(){
var pos : Vector3 = shooter.TransformPoint(shooter.position);
var ray : RaycastHit;
var im : boolean  = Physics.Raycast(pos,shooter.forward,ray,firerange);
var s : GameObject = Instantiate(shot,pos,t.rotation);
s.transform.LookAt(targ.position);
if (im==false){ray.distance=firerange;}
s.transform.localScale.z = ray.distance;
s.transform.position = (pos + (shooter.forward*(ray.distance/2)));
if (im==true){
if (ray.transform.gameObject.tag == "Shield"){ray.transform.gameObject.SendMessage("Effect",ray);}
else{Instantiate(effect,ray.point,t.rotation);}
ray.transform.gameObject.SendMessage("Damage", damage);}
yield;
Destroy(s,1);
}

thanks

TransformPoint(point) converts the local coordinates point to world coordinates. Since transform.position is already in world coordinates, it will return a point far, far away from what you expect. If you want to instantiate the object at some distance ahead of the shooter, you should use:

  var pos = shooter.position + shooter.forward * distance;