Stamina Recharging

I’m trying to make an open world game where the player can sprint, the stamina decreases fine but i cant get it to regen i have 2 files one for the slider and one with the stats

EnergySlider.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class EnergySlider : MonoBehaviour
{
     public Slider energySlider;
    
    public void SetSlider(float amount)
    {
        energySlider.value = amount;
    }

    public void SetSliderMax(float amount)
    {
        energySlider.maxValue = amount;
        SetSlider(amount);
    }
}

EnergyBar.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EnergyBar : MonoBehaviour
{
    
    [SerializeField] private float maxHealth;
    private float currentHealth;
    

    public GameObject GameStats; //Player Stats an stuff

    private EnergySlider stamina;

    public bool noenergy = false;

    private void Start()
    {
        currentHealth = maxHealth;

        // Finding the HealthSlider component
        stamina = GetComponentInChildren<EnergySlider>();

        if (stamina != null)
        {
            // Setting the maximum health for the health slider
            stamina.SetSliderMax(maxHealth);
        }
        else
        {
            Debug.LogError("stamina component not found on this GameObject or its children!");
        }
    }

    private void Update() 
{
    if(Input.GetKeyDown(KeyCode.E))
    {
        currentHealth -= 20;
        UpdateHealthUI();
    }

    if(currentHealth <= 0) // Corrected the comparison operator
    {
    
        
        noenergy = true;
    }
    if(Input.GetKey(KeyCode.LeftShift))
    {
        UpdateHealthUI();
        currentHealth -= 2; // Corrected the syntax to increment currentHealth by 5
    }
}

    private void UpdateHealthUI()
    {
        if (stamina != null)
        {
            stamina.SetSlider(currentHealth);
        }
        else
        {
            Debug.LogError("HealthSlider component not found!");
        }
    }
}

Can anyone help with this?