Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can you loop through a data store?

I've tried get children and for i = 1,#store do print(store:GetAsync(i)) end -- String expected

what do I do qq

2 answers

There is really no way to iterate(loop) through a DataStore without keeping data in a table in a script, unfortunately... You can keep the data you use in a table or use RbxDB by crazyman32. You will have to change the DataStore it looks at if you are not using the default GlobalDataStore. (EDIT) Crap I just saw what you wanted, anyways... You need to call the function tostring with the i variable. But to get the data count, you are not able to unless you did what I said above.

You can loop through data store it is possible,

local DataStore = game:GetService("DataStoreService"):GetDataStore(name) --just a little tip c:

This discussion is preserved as it was. New answers, comments, and votes are closed.