solved regeneration

Hej guys and girls I’m trying to get a regeneration system on my health script but it is only throwing errors at me. I’m trying to learn and experiment on my own but I can’t get it to work.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.SceneManagement;

public class PlayerHealth : MonoBehaviour
{
    public int startingHealth = 100;                            // The amount of health the player starts the game with.
    public int currentHealth;                                   // The current health the player has.
    public Slider healthSlider;                                 // Reference to the UI's health bar.
    public Image damageImage;                                   // Reference to an image to flash on the screen on being hurt.
    public AudioClip deathClip;                                 // The audio clip to play when the player dies.
    public float flashSpeed = 5f;                               // The speed the damageImage will fade at.
    public Color flashColour = new Color(1f, 0f, 0f, 0.1f);     // The colour the damageImage is set to, to flash.
    MouseLook playerLook;
   


    Animator anim;                                              // Reference to the Animator component.
    AudioSource playerAudio;                                    // Reference to the AudioSource component.
    PlayerMovment playerMovement;                              // Reference to the player's movement.
    Gun playerShooting;                              // Reference to the PlayerShooting script.
    bool isDead;                                                // Whether the player is dead.
    bool damaged;                                               // True when the player gets damaged.
    float Regeneration;
   

    void Awake()
    {
        // Setting up the references.
        anim = GetComponent<Animator>();
        playerAudio = GetComponent<AudioSource>();
        playerMovement = GetComponent<PlayerMovment>();
        playerShooting = GetComponentInChildren<Gun>();
        playerLook = GetComponent<MouseLook>();

        // Set the initial health of the player.
        currentHealth = startingHealth;
    }


    void Update()
    {
        // If the player has just been damaged...
        if (damaged)
        {
            // ... set the colour of the damageImage to the flash colour.
            damageImage.color = flashColour;
        }
        // Otherwise...
        else
        {
            // ... transition the colour back to clear.
            damageImage.color = Color.Lerp(damageImage.color, Color.clear, flashSpeed * Time.deltaTime);
        }

       
       

        // Reset the damaged flag.
        damaged = false;
    }

   


    public void TakeDamage(int amount)
    {
        // Set the damaged flag so the screen will flash.
        damaged = true;

        // Reduce the current health by the damage amount.
        currentHealth -= amount;

        // Set the health bar's value to the current health.
        healthSlider.value = currentHealth;


        // Play the hurt sound effect.
        playerAudio.Play();

        // If the player has lost all it's health and the death flag hasn't been set yet...
        if (currentHealth <= 0 && !isDead)
        {
            // ... it should die.
            Death();
        }
    }


    void Death()
    {
        // Set the death flag so this function won't be called again.
        isDead = true;


        StartCoroutine(IsDead());
    }

    IEnumerator IsDead()
    {
        playerAudio.clip = deathClip;
        playerAudio.Play();
        yield return new WaitForSeconds(.15f);

        SceneManager.LoadScene(1);

    }

    IEnumerator Regeneration()
    {
        yield return new WaitForSeconds(2f);
        currentHealth += 1;
    }

    void damagetaken()
    {
        if(currentHealth <= startingHealth)
        {
            Debug.Log("healing");
            StartCoroutine(Regeneration());
        }
    }
}

What doesn’t work?
Please describe your problem in more detail,
What should happen and when.
And what happens instead.
Put Debug.Log in more places, to track issues.

//Maybe you need to call
StartCoroutine(Regeneration());
//in your awake