Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can you loop through a data store?

Asked by 10 years ago

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

Log in to vote
0
Answered by
Gamenew09 180
10 years ago

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.

Ad
Log in to vote
-1
Answered by 10 years ago

You can loop through data store it is possible,

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

Answer this question