Saving High Score..

I have a very basic point system set up and i was wondering if there was a simple way to save the score when the player dies.

If you place the player point system in the game mode instead of on the character or player it will remain. You could make a struct that holds all your variables in your point system, make that struct and set each element, and then add it to an array of the struct type each time the player dies, and resetting the player point system back to default values. If you want to keep those scores for the next time you open the game up look at creating and loading a save game object in the documentation. Explains exactly how to do that.

Another place to store it could be your gameinstance, or gamestate. You’ll probably want to learn how to save it using savestates.

Hey there,

There are multiple places you can save a highscore.

While the game is running, you can use the “PlayerState” class to save your Highscore. It’s accessible via the PlayerController (and PlayerCharacter i think) by just searching
for “PlayerState”. You can create your own “PlayerState” class, similar to creating your own PlayerController etc. You need to specify the PlayerState you are using in the

This is the most common place for highscore and stuff. You will find that this class already has a Score and PlayerName variable. You can ignore them for now.

Another place would be the GameInstance. Difference between PlayerState and GameInstance is big, but the biggest diff is that the GameInstance is the only class that (normally)
survives level changes. Means, if you save the score in the PlayerState and switch the level, you will need to save it somewhere first.
If you save it in the GameInstance, it will survive. BUT, don’t fill the GameInstance with tons of variables to get them into the next level.

Another way is, to directly save the stuff into a SAVEGAME. You can learn how they work here:

That’s also the way you would take when saving the Highscore in the PlayerState and then switching the level.
Or when closing the game.

GameInstance will be deleted when you close the game. So at that point, you should definitely save your highscore to a savegame!