pick item and add health script have problem

Hello:
I got this problem when i’m designing my player health system, this is my script attached to the player:

 public class PlayerHealth : MonoBehaviour {
    
        public int startingHealth = 100;
        public int currentHealth;
      
    	void Awake () {       
            health.Initialize();
            health.MaxVal = startingHealth;        
        }
        void Start()
        {
            currentHealth = startingHealth;     
        }

    	void Update () {
             health.CurrentVal = currentHealth; 
        }
    
        public void TakeDamage(int amount)
        {
            if (isDead==true)
            {
                return;
            }
            isDamage = true;
            currentHealth -= amount;
            animt.SetTrigger("IsDamage");
            if (currentHealth<=0&&!isDead)
            {
                Deadth();
            }     
        }

        private void OnTriggerEnter(Collider other)
        {
            if (other.tag=="Life")
            {
                if (currentHealth>=startingHealth)
                {
                    currentHealth = startingHealth;
               }
                if (currentHealth<startingHealth&&currentHealth>0)
                {
                    currentHealth += 10; 
                }
                if (currentHealth<=0)
                {
                    currentHealth = 0;
              }
            }
        } 
    }

and this script attached to the add-health item:

public class AddLifescript : MonoBehaviour {
    
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag=="Player")
        {        
            Destroy(this.gameObject);        
        }
    }
}

this two scripts did their job just fine, but i found that they are not extensible. if i have more items , i have to add them all to the playerHealth.cs, that is not very effective in my opinion. so i changed them, like this, the script attached to the player:

 public class PlayerHealth : MonoBehaviour {
    
        public int startingHealth = 100;
        public int currentHealth;
    
        [SerializeField]
        private Stat health;
        
    	void Awake () {
    
            health.Initialize();
            health.MaxVal = startingHealth;
        }
        void Start()
        {
            currentHealth = startingHealth;     
        }
    	
    	// Update is called once per frame
    	void Update () {
             health.CurrentVal = currentHealth;
         
        }
    
        public void TakeDamage(int amount)
        {
            if (isDead==true)
            {
                return;
            }
            isDamage = true;
            currentHealth -= amount;
            animt.SetTrigger("IsDamage");
            if (currentHealth<=0&&!isDead)
            {
                Deadth();
            }     
        }
    
 
public void AddLife(int addLife)
    {   
            currentHealth += addLife;
            Debug.Log(currentHealth);
        if (currentHealth >= startingHealth)
        {
            currentHealth = startingHealth;
        }

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

the script attached to item:

public class AddLifescript : MonoBehaviour {
    public GameObject player;
   PlayerHealth playerHealth;
   public int healthAdd = 10;

    private void Awake()
    {
       playerHealth = player.GetComponent<PlayerHealth>();
    }
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag=="Player")
        {
            playerHealth.AddLife(healthAdd);            
            Destroy(this.gameObject);        
        }
    }
}

but these two scrips didn’t work very well, the problem is the debug.log in addLife function shows 110,120 when i picked up a health item, but the currentHealth remain the same amount , has no changes. the the health slider has no change too. this really bother me. thank you if anyone can help me with this .

---------more detail about my problem:
the whole AddLife() function just don’t work correctly. if the player’s health is 100, i pick up an item, the debug log will show “110” , not 100. if the player got hurt, the health slider decreased, it work no problem, display correctly, the player will even die if the health slider is equal to 0. but no matter how many items i picked up, the debug log keep showing “110”, not the right health value. and the slider value remains the same, no increase.

If I understand your intention correctly, it looks like you’re just resetting the value when you don’t want to. On line 47, the health will be 110. Then, on line 48 you’ll log the right value, 110. The problem is on line 49, 110 will be greater than starting health of 100. So you’ll reset it to 100. So when the function exits, you haven’t actually changed anything.