How do I make my projectile deal damage to a target it hit.

void Rocket()
{
currentAmmo–;

    GameObject gameObject = Instantiate(projectile, transform) as GameObject;
    Rigidbody rb = gameObject.GetComponent<Rigidbody>();
    rb.velocity = transform.forward * projectileSpeed;
}

void Fire()
{
    currentAmmo--;

    GameObject gameObject = Instantiate(projectile, transform) as GameObject;
    Rigidbody rb = gameObject.GetComponent<Rigidbody>();
    rb.velocity = transform.forward * projectileSpeed;
}

I can’t get my projectile to deal damage based on a varible in the script.

You will need a trigger collider on your projectile, then listen for OnCollisionEnter on the target. You can deal damage to your target there. Hope i understood the question.