How do I...? [scripting help]

I need help with making a projectile disappear after x seconds have passed, but I have no clue how to set a lifespan, any help?

Here's what I tried but nothing worked (it's compiled attempts from other tutorials I've seen).

using UnityEngine;

using System.Collections;

using System;

public class Projectile : MonoBehaviour {

    public float ProjectileSpeed;

    protected float mLifeSpan;
    public float lifeSpan{get{return mLifeSpan;}}

    // Use this for initialization
    void Start () {
        mLifeSpan = 1.0f;
    }

    // Update is called once per frame
    void Update () 
    {
        float amtToMove = ProjectileSpeed * Time.deltaTime;
            transform.Translate(Vector3.forward * amtToMove);
    }

    protected IEnumerator kill()
    {
        yield return new WaitForSeconds(mLifeSpan);
        Destroy(gameObject);
    }

}

Any tips?

You can just use Destroy for that, no need for coroutines or anything:

using UnityEngine;

public class Projectile : MonoBehaviour {

    public float projectileSpeed = 10.0f;
    public float lifeSpan = 1.0f;

    // Use this for initialization
    void Start () {
        Destroy(gameObject, lifeSpan);
    }

    // Update is called once per frame
    void Update () {
        transform.Translate(Vector3.forward * projectileSpeed * Time.deltaTime);
    }
}

You're very close. You need to start the "kill" coroutine when you start the script. Add this to your Start method ...

StartCoroutine(kill());