Restarting a level and keeping the data

I was trying to make a level with more than just one life (meaning 3). I managed to do the scripting, the health system works fine (I did it with the help of a verified youtuber, so it sure isn’t wrong). The problem is, that everytime the player dies, the scene restarts, and altough a little heart disappears, after restarting the level it appears again as if the player never died. My question is, how can I solve the problem of transporting the data to the restarted level? Or is there any other way to restart the level that saves the information acquired before? Thank you, and have a nice day! (btw I really am a beginner, most of the things I did was watching videos and trying to duplicate them/make my own version out of it. so pretty please, give an answer that a noob like me could understand as well. Thank you! :))

@dancus25_unity, Are you using the Scene Manager to reload the scene? You’ll have to save any data you want to retain either to a Static class that is not attached to any game object (and does not inherit from MonoBehavior), or set up a Singleton on a gameObject that is set to DoNotDestroy.

That means you’ll also need to have code in your Scene startup that will check how many hearts to show based on your current life.

A better way is to not reload the scene, just wipe your level changes back to the their starting values, except of course for the hearts.