Turret shooting at me

Hi im using Tornado Twins’ YouTube series on how to make a turret shoot at me using this script:

    var LookAtTarget : Transform;
var damp : float = 6.0;
var bullitPrefab : Transform;
var savedTime = 0;

function Update ()
{
     if(LookAtTarget)
     {
          var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position); 
          transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp); 
          var seconds : int = Time.time;
          var oddeven = (seconds % 2);
          if(oddeven) 
              Shoot(seconds);
          //transform.LookAt(LookAtTarget);
     }

}

function Shoot(seconds)
{
     if(seconds!=savedTime)
     {
          var bullit = Instantiate(bullitPrefab ,transform.Find("spawnPoint").transform.position , Quaternion.identity); bullit.rigidbody.Addforce(transform.forward * 1000); savedTime=seconds;
     }
}

I put my missile prefab on it, which i made in the Unity FPS tutorial, explodes when it hits a wall and makes sound. When I attach the script to the turret it just shoots tons and tons of missiles, so fast that they hit each other and explode. Can someone help fix this problem please? Thanks in Advance!

This code uses a weird method to space the shots: it only shoots when the time changes to a new odd second (1, 3, 5 etc.)

I would use a different approach: after each shot, set a dead time - this allows control of the shot interval (which’s fixed in the Tornado Twins code).

var LookAtTarget : Transform;
var damp : float = 6.0;
var bullitPrefab : Transform;
var shotTime: float = 0;
var shotInterval: float = 2;

function Update ()
{
     if(LookAtTarget)
     {
          var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position); 
          transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp); 
          if (Time.time > shotTime){ 
              Shoot();
              shotTime = Time.time + shotInterval;
          }
     }
}

function Shoot()
{
     var bullit = Instantiate(bullitPrefab, transform.Find("spawnPoint").transform.position, Quaternion.identity);
     bullit.rigidbody.Addforce(transform.forward * 1000);
}