!!!
and I need to figure out how to change the data of all players that have used the datastore without them in the game. For instance a 3 players have 30 objective/task values in a datastore each(and each value has a different number based on completion), and precisely at 8:00 PM all of that data is reset to zero. I already have the daily script part, from this tutorial How to Make Server-Synced Daily Shops I just need the datastore part…
So is it possible to even do that? Could you tell me how to reset data that way?
You can store a time value in the datastore, and whenever a player joins after the data gets wiped, you check that value to see if it’s up-to-date. If it’s not, then reset the data.
This works, although if a Datastore’s name is too large, it can error. It becomes an issue later on which can be a giant problem since you may also accidentally wipe progress people have made after a reset, depending on how old a server is.
There is no character limit its how you hold the values.
Also I don’t seem to know why you need a large name, something as simple as “Test551A” would work.
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?
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?