All Three Game Objects Fire At Once

Hey I have three game objects/Bullet Factories that fire all at the same time when i press spacebar instead of them fire individually when selected any ideas ? here is my script

#pragma strict
var bullet : Rigidbody;


function Start () 
{

}

function Update () 
{
if(Input.GetKeyDown("space"))
{
//everything inside brackets runs

	var latestBullet = Instantiate(bullet, transform.position, transform.rotation); 
	latestBullet.AddRelativeForce (0, 0, 500);
}


	
}

You must enable the shooting code only when the object is selected. Supposing that this script has a public boolean variable selected that is true when the object is selected, the code can be like this:

#pragma strict

public var bullet : Rigidbody;
public var selected : boolean = false; // set this to true when object selected
 
function Update (){
  if (selected && Input.GetKeyDown("space")){
    var latestBullet = Instantiate(bullet, transform.position, transform.rotation); 
    latestBullet.AddRelativeForce (0, 0, 500);
  }
}