GameInstance is only persistent while you run the game. For score keeping you’d really need to write the info to disk.
In content browser, create a Struct called PlayerScores. Edit it so it has a string called Name, and an integer called Score.
In content browser, create a SaveGame class called YourSaveGame.
Edit the YourSaveGame class: add a struct variable of PlayerScores, then click the array button (so you can save an entire array of data).
In content browser, create a YourGameState class.
In the world settings, make sure your GameMode uses YourGameState.
Edit YourGameState, in the eventgraph, on beginplay fire a Does Save Game Exist? with a slot name, such as slot1
Branch, if true, fire a Load Game From Slot (slot1) … if false, fire a **Create Save Game **(slot1).
For both, promote and set variable YourData (of type YourSaveGame).
Now all you need to do is tell your UMG widget to send the player input string (if it’s not nothing) and score integer to the GameState and make a PlayerScore struct, which you commit using SetArrayElement to YourSaveGame struct array.
There are several ways to send variable values between UMG widget and another class or actor. (Look up Blueprint Communication). From UMG you can Get Gamestate, cast to YourGameState, then call a CustomEvent or function in it and pass in the variables as inputs.
And on Load Game From Slot, you can lookup YourGameState>YourData>PlayerScores array, and get the array entry with the highest score, or print the entire array to a text slot of some kind.
Remember it can be helpful to make variables you’ll pass here and there to be Editable and Exposed on Spawn, whatever helps them to be visible and changeable from elsewhere. And compile and save before looking them up in another blueprint.
Remember you may need to delete from /GameProject/SaveData/Saves/ your .sav file if you later make some project change which disrupts the current values in it during development. Say, if you add an extra feature to the struct you want to save.
FYI – TappyChicken in the learning content includes a demo of saving/loading data such as a score.