Destroying a instantiated prefab?

I know there’s many questions like this one here already, iv’e tried most of them and they doesn’t seem to work.

So, what I’m trying to do (as the title says) is to destroy a instantiated prefab to prevent lag.
This is my current code, which doesn’t work :

using UnityEngine;
using System.Collections;

public class Shooting : MonoBehaviour
{
    public Rigidbody projectile;
    public float speed = 20;
    public float destroyTime = 3.0f;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            //Shooting sounds should be played inside here.
            Rigidbody instantiatedProjectile = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody;
            instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0, speed));
            Destroy(instantiatedProjectile.gameObject, destroyTime);
        }
    }
}

having all the code in the same script will cause problems what you can do is make another script called destroyafter and attach it to the prefab of the projectile
the script would look something like this
using UnityEngine;
using System.Collections;

public class DestroyAfter : MonoBehaviour {
public float LifeTime=50;

void Update()
{
Destroy(gameObject,LifeTime);
}
}

Code started working the next day somehow…