My weapon takes damage. help...

In my game I can take damage from an enemy sword, but so can my sword because it’s attached to my player. I can’t take it off my player in the Hierarchy because then it wont follow where I look. How would I go about not taking damage from my sword?

Here’s my Player’s code for colliding with the enemy sword:

private bool yesHurtMe = true;

void OnTriggerEnter(Collider other){

	if (other.name == "Enemy Sword" && yesHurtMe == true){

		will -= 20;

		yesHurtMe = false;

	}

}

void OnTriggerExit(Collider other){

	if (other.name == "Enemy Sword" && yesHurtMe == false){

		yesHurtMe = true;

	}

will is my Health.

Since the weapon is attached to the player, do a check with the collider to ensure its not detecting the contact with it’s parent. Something like

if(other.transform != this.transform.parent)
{
// Attack Code here
}