How do I get two scripts to share a context?

I’m making a game, and made it to the health bar when I started having a serious problem. I have no idea what the code is having so much trouble coping with, but it keeps returning the error " currentHealth does not exist in the current context."

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

public class HealthBar : MonoBehaviour
{

    private Image healthBar
    public float maxHealth = 20;
    public float currenthealth = 10;

    void Start()
       {
        healthBar = GetComponent<Image>() void Update() 
       }
   
       {
        healthBar.fillAmount = currenthealth / maxHealth;
       }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Heart")
        {
            currentHealth = maxHealth;
        }

        if (collision.gameObject.tag == "HealthUp")
        {
            maxHealth = maxHealth + 2;
            currentHealth = maxHealth;
        }

        if (collision.gameObject.tag == "Spawner")
        {
            currentHealth = currentHealth - 1;
        }

        if (collision.gameObject.tag == "Monster")
        {
            currentHealth = currentHealth - 1;
        }
    }
}

I would appreciate any help in figuring out what’s going wrong here

Well, you seem to be new to programming and C#. However hopefully you understand the purpose of the curly braces. They always define a “block” / scope / body that belongs to whatever appears directly before it. So I encourage you to look very closely at your code again. You defined your “Update” method inside the start method but the corresponding body is outside. You shouldn’t define your Update method inside any other method because Unity would not call nested local methods.

So you may just have misplaced your closing brace from your Start method and accidentally deleted the lines between the end of your Start method and the beginning of the Update method.