How would I make a sword in 3D hit an object x amount of times, and then have the object that got hit disappear?

I am sort of new to combat, and I need to figure out how to be able to hit an enemy x amount of times before the enemy dies. I just need a simple solution with code, but I already have a collision with trigger o it.

You can try to apply the collision component to trigger collision, and record the number of collisions to determine the number of hits.
like this:

void OnCollisionEnter(Collision other)
{
    if (other.gameObject.tag == "Player")
    {
        //record a collision
    }
}