Changing the alpha of a sliders fill?

I’m following the tutorial for the survival shooter and noticed that when the value of the health bar is 0 there is still some fill left in the slider. I want the sliders fill to not be visible when the sliders value is 0. Is there a way to change the alpha of the sliders fill color? Or is there another way to do this?

I thought that I could just create and if statement that changes the alpha of the fill when the value is 0 but I can’t seem to figure out how to access the sliders fill color withing the script.

@DVecc

You need to go to your UI and there should be a game object that contains the Heart and Slider components.

Add a CanvasGroup to this game object.

Check the box that says ignore parent group.

And access it by using code similar to this.

using UnityEngine;
using UnityEngine.UI;                   // Add this first
using System.Collections;

public class Target : MonoBehaviour
{


    public GameObject targetHealthUI;   // Reference to game object with canvasgroup
    CanvasGroup canvasTarget;           // Reference to the canvas group itself

    // You must drag the game object onto this script so targetHealthUI has a reference

    void Start()
    {
        // This is where you set the canvasgroup reference to the 
        // canvasgroup of the gameobject you dragged onto script
        canvasTarget = targetHealthUI.GetComponent<CanvasGroup>();

        // Then somewhere in your code just reference it
        canvasTarget.alpha = 0;
    }
}

What I do is have a variable that is a color with no alpha, and assign that color to be equal to the sliders. I had this same problem and had to get really creative on how to fix it. They should fix that in a unity update or explain how to fix it in a video.
Example in C#;
using UnityEngine.UI;

public Color ClearColor;
public Color healthSliderColor;
public int playerhealth;
if(playerhealth <=0){
healthSliderColor = ClearColor;
//player is dead
}