I’m currently writing a hands-on, in-game DataStore explorer panel so that my development team can browse and read through various DataStores. Unfortunately, I haven’t been able to find a concrete way to actually return all existing DataStores in the form of a table. In explicit terms, I’m looking for a function that returns the name of every DataStore that I’ve created.
Not really an expert at DataStores but, do you want the DataStores to be displayed on GUI? Also I probably do think that you do need to do this manually.
Off-topic: Since class ended just now ima go to studio lol
Yes, the datastores will be displayed on the UI, which I do know how to set up. It’s only the matter of retrieving a list of the existing, separate datastores that I’m concerned about.
I don’t think it’s actually possible to just get a list of all of the datastores in your game, I do remember seeing a ListDataStoresAsync() function for DataStoreService on the wiki but it doesn’t seem to be working at the moment.
Assuming you want to access all the individual player datastores, what you can do is use a global datastore to keep a log of all the player UserIds that have ever joined the game, and then you can use that list to get all of the datastore keys for each player
Output:
16:15:22.745 cloud_336673829.PluginImporterPlugin.Libraries.PluginImporter:95: HTTP 409 (Conflict) - Edit
16:15:22.745 Stack Begin - Studio
16:15:22.745 Script ‘cloud_336673829.PluginImporterPlugin.Libraries.PluginImporter’, Line 95 - function ImportPlugin - Studio
16:15:22.746 Script ‘cloud_336673829.PluginImporterPlugin.Core.Components.RecentsPage.ResultsCanvas’, Line 21 - function Clicked - Studio
16:15:22.746 Script ‘cloud_336673829.PluginImporterPlugin.Packages.Roact.SingleEventManager’, Line 83 - Studio
16:15:22.746 Stack End - Studio
local DSServ = game:GetService("DataStoreService")
local pages = DSServ:ListDataStoresAsync() -- Get datastore pages
while wait() do
for _, item in ipairs(pages:GetCurrentPage()) do -- List Datastores on current page
print(item.DataStoreName) -- Print Datastore name
end
if pages.IsFinished then break end -- Stop listing if this is the last page
pages:AdvanceToNextPageAsync() -- Go to next page
end