Trying to save a score across levels

So, i have a score variable, and an enemy that decreases that score and a goal the increases it. when i load a new level, which happen when you hit the goal, the game tries to set the score to 0 because i have the score defined a public, so that i can save it and access it other places. how do i make it so that the score persists between levels and the game doesn’t try to set it to 0?
thanks in advance.
Twoshark.

you can learn about methods to do this here

You will want to store the score separate from scenes that will be unloaded/loaded. Ergo, you don’t want to save the score in any particular level itself.

This could be as simple as a static class, or a DontDestroyOnLoad game object, or in an additively loaded scene. You’ll find plenty of examples of all of those online.