Hi. I’d like to be able to save a list of players who have a save file in my game.
I’ve already considered using Datastores, but that would be too inconsistent, if 2 players saved at the same time, then the game would retrieve an unupdated version of both tables, and then resave it, resulting in one of them not being saved properly (Not to mention it’d be very inefficient).
I’d like a way to be able to solve that problem, OR, if you can offer me a way to find every key in the datastore that has something saved to it. It would help a lot. Thanks!
I don’t mess with DataStores frequently, but even if it were inefficient, you could make a sort of “queue” for every player that has joined, and then save it for example every 2 minutes if it has any data. This way it only ever saves once. As for other methods I don’t know of any others.
You can use :ListKeysAsync() to get a list of keys in a datastore. Use that on the datastore that stores savefiles and you have a list of players who played the game.