Just change the datastore name, I posted on this section a few hours ago, it’s the easiest and the best option.
(to reset the datastore)
I have one question though, lets say I had a datastore with the random name of “robloxIsGreat”, then the next day it was “greatIsRoblox”, and then the next day it was “robloxIsGreat” again, would day 3’s data start off with day 1’s data?
Each time you change the name, all of the players’ data gets wiped.
Hey, I have an idea how to store unique daily datastore’s names!
I have used similiar method to generate UUIDs.
local dateTable = os.date("*t")
local dataStoreName = "DS"..dateTable.yday..dateTable.year
-->> example of dataStoreName = DS2212021
-->> the benefits of this are - low amount of characters,yday is once per year (obviously) + year is another unique aspect of this method
Day 1: Data name is called "FirstDataSet"
Day 2: Data name is called "SecondDataSet"
Day 3: I set the name back to "FirstDataSet"
. Now the data from day 1 has returned. Renaming it basically just reads from a different collection of saved data. If I save something in "DataSave1"
and return to it later, it will read the data that was stored there from before.
TLDR: It doesn’t get reset and will be there still even if you come back to it later. Changing the name to something different will indeed appear like the data has been wiped to others, but behind the scenes all you did was change what datastore you are reading from.
ok thanks, I will make sure that it doesn’t duplicate names!
I just thought of something though, what happens if there are two servers open while it changes the name, won’t there be two different names? Or will one of them overwrite the other, what should I do about that?
I recommend just shutting down all the servers once you change it. This way, every new server created will have the new datastore.
I feel like there has to be a way to do it without doing that, because I am certain that everyone who plays my game will hate getting kicked everyday…
Yes, you can use it like that, the type of datastore I made does, this may differ from each one however!
I am confused, does this help my problem or just reinforce it? Sorry I might just not be understanding.
It’s ok of you don’t understand, here is what I meant.
You could try it with your game, everytime I reset the datastore in my game to a new one, then I revert it back, data stays. You should try it with yours and check, only if no one had data already!
Try what? I think that is where I mainly lost you, what am I supposed to do. Sorry
thankfully this is a new frontier for my so no one else has data but me
How would I do that? The reverting back part? Wouldn’t I still have an issue with multiple servers?
One. Try resetting the datastore to something then revert it back and test.
Two. Already explained.
Three. Example: your current store is DSS1, get some data on it, then change it to DDS2, then get data on that, then reverse it back to DSS1. And also you won’t have an issue with it if you shutdown servers and publish them before releasing as they then will have the updated values.
You should also remove the solution so other people can come and help as people will think its already been taken care of.
Thanks man I can try that
Oh but that was never the issue, it was people not liking the servers being shut down everyday…
I am giving you the solution for now, just because…
unless it doesn’t work for some reason
You welcome for the help, if they do not like shutdowns, you can tell them its better for the game. If it doesn’t work you can dm me here on the forum and I can help from there.
But does this work while the server is already going?
Yes it does, you just gotta update the game to apply those changes.
FWIW since this thread was bumped back up: now that DataStore v2 has been launched, you could hard reset a DataStore by calling RemoveAsync on all existing keys. There’s a 30 day period where data needs to be in a tombstone version for it to be cleared out completely.
You should still change the DataStore name if you need to “reset” your DataStores because that’ll allow you to update data more quickly especially for a production-level experience but otherwise for development, testing and clearing unused data you can manually wipe it now.
ListDataStoresAsync to get previously used DataStores → ListKeysAsync to get the keys of a DataStore, up to you if it should iterate all scopes or just specific ones → Call RemoveAsync
When you say update is that like publish to Roblox, because I need it to update while the server is still running with potential players still in the game.