Player life wont go down, where is the problem?

I have it so that when my player life hits zero, he dies and so the player health script tells the gm script to take a life away. This isn’t happening, but when the player picks up a coin the gm script still adds coins so I don’t think the gm script is the issue but I cant find anything wrong with my player health script. I know the player is dying because his transform gets reset like playerhealth tells it to.

gm script:

    using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.SceneManagement;
    public class GM : MonoBehaviour {
    public int coins = 0;
    public int lives = 3;
    
    public Text coinsText;
    public Text livesText;
    
    
    void Start()
    {
        coinsText.text = coins.ToString();
        livesText.text = lives.ToString();
    }
    
    void Update()
    {
    
        //Game over Screen
        if (lives == 0)
            {
            SceneManager.LoadScene("GameOverScreen");
        }
    }
    
    public void CoinWasPickedUp(int worth)
    {
        coins += worth;
        coinsText.text = coins.ToString();
    }
    
    public void LifeLost()
    {
        lives -= 1;
        livesText.text = lives.ToString();
    }
    }

playerHealth script:



   using System.Collections; using System.Collections.Generic; 
    using UnityEngine;
    public class playerHealth : MonoBehaviour {
    
    public float fullHealth;
    float currentHealth;
    PlayerController controlMovement;
    Vector3 startPosition;
    
    Rigidbody2D rb;
    
    void Start ()
    { 
        currentHealth = fullHealth;
    
        controlMovement = GetComponent<PlayerController>();
    
        startPosition = transform.position;
    
    }



public void addDamage (float damage)
{
    if (damage <= 0) return;
    currentHealth -= damage;

    if (currentHealth <= 0)
    {
        Die();
    }
}

public void Die ()
{
    transform.position = startPosition;
    rb.velocity = new Vector2();
    FindObjectOfType<GM>().LifeLost();
}
}

It looks like there is a problem with LifeLost() method. I can see you’re using the FindObjectOfType to find the object contains GM script. Are you sure there is only one Game Object loaded which contains GM script?

Maybe try changing the if(damage <= 0) to a if(damage >= 0) in the addDamage method?

That is weird about calling LifeLost() in Die(). Isn’t LifeLost() is a method that make player health -= 1? So the logic is when player take damage three times, it died and then call LifeLost() make GM.live -= 1? In this way isn’t GM.lives remain 2?