DataStore2 how can I wipe/edit a specific key in everyones data?

I believe datastore2 actually makes sure all data requests are made and not dropped. I will have to double check on that. But the best I can probably do is not just blindly iterate and change through everyones data but instead make sure that their data NEEDS to be changed. e.g iterate through it and if their location data is close to the location I want to change I will clear it. That way I don’t edit potentially thousands of player’s data for literally no reason. Just incase I am wrong about datastore2 making sure nothing gets dropped is there a way to make sure everything gets through. Is there a way to check if the queue is close to full so it can wait?

also unrelated question but what is the difference between using os.time() and tick()? They both seem to do the same thing if im not wrong.

You can use GetRequestBudgetForRequestType to check. DataStoreService | Roblox Creator Documentation

I’m not sure how you’ll know who’s data NEEDS changing without iterating through everyone but I’m sure you’ve thought of that (as GetAsync has limits too). Don’t use DataStore2 myself so can’t comment on that.

time.os() returns an integer whereas tick() returns a float. time.os() will be UTC-0 wherever called but tick() has dependency on local time settings of the machine it’s called on.

1 Like

Iterating seems challenging but definitely a viable method.
Should I just change the key instead? and if I do decide to change the key every time I want to update the map would there be any long-term consequences? And if so is there a way to prevent those long-term consequences? Also, I appreciate all the help you’ve been giving so far. Thank you.

What I do, is put a property for save version in the save data, and then have version upgraders to convert data up to the latest version. Managing data like this on an ad-hoc way is usually going to be less resource intensive than iterating/updating through all profiles. (The only issue which would need considering here is: what happens if a player joins an earlier server version? Although shutting down all servers is a simple but disruptive way around this.)

3 Likes

There is no downside to just leaving behind tons of unused data over time?

DataStore2 by design leaves behind unused data every time a save is made anyway? In version converting systems I do delete now unused variables.

1 Like

I suppose I will just do that then. Thank you for all the help and for being patient.