How do I use a delay?

I have a working gun, where it shoots every 0.5 seconds. But, all the clones of my projectile are really lagging my scene. So… I wish to kill a fired projectile after an amount of time. How do I do this? My code so far is attached

#pragma strict
var projectile : Transform;
var myVar : boolean = false;
public var spawn : GameObject;

function Start () {
	InvokeRepeating("Shoot", 0, 0.2);

function Update () {
		myVar = true;
		myVar = false;

function Shoot(){
		 var pel = Instantiate(projectile, spawn.transform.position, spawn.transform.rotation);
		pel.rigidbody.AddForce(transform.forward * 5000);

Do Destroy(gameObject,2); In the update, you could try putting it in the start, idk if it’ll work the same. Haven’t tried.

I think this is how you do it. You would do that for C# with the exception that there’d be an F after the 2 for Float.