Does anyone know how to create a script where, for example, when a datastore reaches 50 keys, everything is deleted there? I know nothing about datastores, so sorry if this is a dumb question
Are you talking about datastore keys or table information?
Could you possibly elaborate your question and explain it more? Like do you want when a data store for a player reaches 50 varibals it’ll get deleted? Or that when a varibal surpasses 50 letters it’ll get deleted? I cannot understand what you mean
I don’t know the correct name, but like, if you get to 50 things from a key stored there, delete everything
I just replied to the guy below you
Something like if there are 50 players with a registered safe file, delete all save files?
I’m not sure if you’re referring to the word “files”, but I’ll describe the idea as I understand it.
Think of a datastore like a structured storage system, kind of like a table with rows. You have data organized under keys, like “Key_ExampleData,” “Key_ExampleData2,” and so on.
What you want to do is this: Imagine you have multiple instances of “Key_ExampleData” in your datastore, and you want to remove all of them when there are five or more. To accomplish this, you would create a script that runs in a continuous loop.
This script checks the datastore every 5 seconds to see if there are five or more instances of “Key_ExampleData.” If it finds five or more, it will delete all of them.
In simpler terms, you’re setting up an automatic process that regularly looks at your data storage, and when it sees a certain number of items, it deletes them.
*I used chatgpt to make it easier to understand
I sill dont understand what you mean however if you wanna check something you could do it via a server scirpt like. if player.Leaderstat.Coins == (idk) then do, its way more efficient than checking the data store.
I will not store data from players but from the server, for example, store specific codes for a while, without storing in StringValues.