Can someone help me?
I want a script that deletes data from a datastore if it has more than 50 data in a key.
For example:
Key_DataExample
Key_DataExample2
…
If it goes over 50, delete absolutely everything
Can someone help me?
I want a script that deletes data from a datastore if it has more than 50 data in a key.
For example:
Key_DataExample
Key_DataExample2
…
If it goes over 50, delete absolutely everything
I haven’t done this before, but maybe you could use ListKeysAsync and DataStoreKeyPages. Once the page has 50 data store keys, you could use :RemoveAsync()
. Again, I haven’t used this before so I am not sure if it will work well.
Why would you want to do this? It would help if you explain what the end result is.
I’m working on an anti-cheat system, but I don’t have any experience with data stores, so I know absolutely nothing about them. I’m asking this because I’m creating a unique code system in my anti-cheat system, and I want to set a code limit. When the datastore reaches 50 codes, all additional codes will be deleted.
I’m confused on why you need codes for an anticheat. What are you trying to do. Or more specifically what are you worried about that exploiters can do within your datastores. To me this seems unreasonable to me for an Anticheat as Datastores are server controlled and not accessable to the client, and it would seem more efficient to protect your remote events & your Int Values then the datastore itself.
If your goal is to store logs of some sort, you can store them in an array and remove the extra entries when your array length exceeds 50.
whatever data you storing in there make it a table and each data has its own index then when saving to that table just check if the # is equal or greater than 50 then wipe that thing off :RemoveAsync()
also if its globally for all players under then same key is the reason why we still do
while true do
print("I has code")
end
Yes, I know that exploiters can’t access my server-side datastore. However, I’m working on a specific script that stores a lot of information, some of which isn’t necessary beyond a specific time frame. To be able to store more things in the datastore, I prefer to delete it to avoid reaching the limit and causing problems later on.
I don’t think that the Datastores themselves have limits as long as you are using different keys.