Hello,
I was wondering how do you can only get the datastores with the player userid in it (with DataStoreService:ListDataStoresAsync)
Thanks to everyone who helps me
~ maini
I’m not too sure what you mean, is the player’s UserId the name of the DataStore? If so you don’t need DataStoreService:ListDataStoresAsync, you can just do :GetDataStore(player.UserId).
If you’re wanting to look in every data store, you would need to:
1- List the data stores (DataStoreService:ListDataStoresAsync())
2- Go through the page (:GetCurrentPage()), then for each item in the page, call :GetDataStore(currentPageItem.DataStoreName).
3- Now, on that returned DataStore, call :GetAsync(key) where key is the player’s UserId, as well as any potential prefix or suffix you may have used. This will be the player’s data in this data store.
4- If dataStorePages.IsFinished is false, call :AdvanceToNextPageAsync, then repeat from step 2 on
Note this is probably not a good thing to be doing at runtime, ideally you’d be keeping track of data store names, key names, etc without needing to list data stores and such.
The problem is, ListDataStoresAsync lists all datastores in the experience, and then you check if there are Datastores with the player user id in it. But because there are to many datastores in my game, ListDataStoresAsnyc gets overstrained and doesn‘t work right anymore.
I’m getting this error:
502: API Services rejected request with error. HTTP 429 (Too Many Requests)
You can try providing a prefix argument to :ListDataStores but you should be keeping track of what datastores are being created, for which players. Ideally you would want to use the least number of data stores and keys for players as possible.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.