Hello, I would like to create a scoreboard for my game. Everything has worked well so far. However, saving and loading does not work properly. Everything works for the first run. The score is saved and loaded the next time. But if you start another round after that without restarting the game, the scoreboard doesn't save anything. What is the reason for this if it works the first time? The numbers and their names are saved in an array. In order to save the values permanently, the array is loaded as a string into a variable and this is saved in a local storage. When loading, the string is loaded from the local storage into a variable, after which it is transferred back into the array. See picture.
I am also a complete beginner and this may not be the best solution. Please bear with me a little.