Health Bar/Hearts?

So, I’ve been researching for WEEKS on end how to make a working heart system for a 2D Unity platformer I’m doing. Only problem is, I’m a total noob just about all things Unity here, and I’m a wee bit new to coding (though I understand C# and how it works).
The biggest problem I’ve been having is using a health system where when the player is hit, a heart vanishes. While I’m absolutely aware that there’s already a thread on the topic, most of it suggests that I use GUI, which I absolutely hate, and the code that doesn’t suggest I use GUI settings is a bit too complicated for the timeframe I have, and I run the risk of ruining my game.
I know I’m asking a lot, and I don’t expect anyone to just WRITE THE CODE for me, I just need a bit of a for-dummies rundown on how this all works.

This is definitely not perfect, but it may be useful to learn how the sprite fill system works in Unity.

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

public class Player : MonoBehaviour {

    [Header("Player")]
    public Player player; //the player object that holds the player script

    [Header("Stats")]
    public int maxHealth; //total amount of hearts
    public int health; //current number of hearts

    [Header("UI")]
    public Sprite healthUI; //use an image of four hearts next to eachother, spacing will help make it look better

    void Update(){ //change the value of your sprite using a horizontal fill, space the hearts out so that 1 includes only 1 heart and so on
        maxHealth = player.maxHealth;
        health = player.health;
        
        healthUI.fillAmount = health / maxHealth; //will always return a decimal for percentage
    }
}

EDIT: I just read your comment and you can include a reference to the Health object if the Player script is attached to your player, just drag it into the slot in the inspector.

tutorial about how to make a heart bar system only using sprites and a small amount of code: