How to make my player not lose health when attacking the enemy?

I feel like this is basic problem but I have set up and enemy (sawblade) that upon colliding with the player will take away 10 health points. However, my player has a slide animation that i am using as a way to attack the sawblade and destroy it. The player slides and hits the enemy destroying it but my problem is that upon doing this the player itself loses health. Below I will place my script from the Sawblade script that I have which indicates that when the player collides with the sawblade the player gets ten points taken away (Take Damage(10)). I thought that if I just did an else statement the sawblade would cancel damage taken when the player collides while sliding but that is not the case, what can i do to fix this?

void OnTriggerEnter(Collider c) {

if(c.tag=="Player"){
GameObject healthGameObject=GameObject.Find("Health");
healthGameObject.GetComponent<Health>().TakeDamage(10);
}else{
if (GameObject.Find("Player").GetComponent<PlayerController>().sliding){
	GameObject healthGameObject=GameObject.Find("Health");
	healthGameObject.GetComponent<Health>().TakeDamage(0);
}

Ok, so what you’re saying in your code is that if the colliding object has the tag of player, take 10 damage, but if the colliding object’s tag isn’t player, take 0 damage. Since your player’s tag is player whether it’s sliding or not, this won’t change anything. Try this:

bool isSliding = false;

void OnTriggerEnter(Collider c) {

if(c.tag=="Player"){
    if(!isSliding) {
        GameObject healthGameObject=GameObject.Find("Health");
        healthGameObject.GetComponent<Health>().TakeDamage(10);
    }

You just have to set the isSliding variable to true every time you slide and you won’t take any damage.

public class SawBlade : MonoBehaviour {

// Update is called once per frame
void Update () {

//RBG (XYZ or Z = VECTOR3)
transform.Rotate (Vector3.forward * speed * Time.deltaTime, Space.World);

}

void OnTriggerEnter(Collider c) {

if(c.tag="Player"){
   PlayerControllerScript controller = c.gameObject.GetComponent<PlayerControllerScript>();
   if(!controller.isSliding){
     controller.isSliding=false;
     GameObject healthGameObject=GameObject.Find ("Health");
     healthGameObject.GetComponent<Health>().TakeDamage(10);
   }else{
     if(controller.isSliding){
      controller.isSliding=true;
     GameObject healthGameObject=GameObject.Find("Health");
     healthGameObject.GetComponent<Health>().TakeDamage(0);
   }
}

}

yep this worked!