I opted to represent the lives with icons rather than a number.
To do this I used three TextureRects on the HUD node, named Lives 3, Lives 2, Lives 1, then implemented this function in the HUD script:
Then I connect the took_damage signal from the player script, so when the player is hit, the lives_UI function checks the number of lives in the main game script and then hides the corresponding sprite. “…/…” seems to be the path for a parent of the node your script is on, I just dragged the game node over from the scene menu.