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

For Loop does not work with Data Stores?

Asked by
Decemus 141
9 years ago

First, I had made a data store for 10 values, and it worked fine and all in my place. I had sent it to someone else and for some reason, it only loaded one value. He had put everything in the right spot. I found it odd, and came here to find the answer to the question. Here is the code, I cut out the variables due to them looking like they did not need to be mentioned.

01for i=1,10 do
02    wait(.01)
03local b = DataStore:GetDataStore("Inv"..i)
04    b:UpdateAsync(key, function(oldValue)
05        local newValue = oldValue or "None"
06        local a = Instance.new("StringValue")
07        a.Name = "ToolN"..i
08        a.Parent = player
09        a.Value = newValue
10    end)
11end

Yes, I stated player and key.

0
where's the rest of the for-loop? XAXA 1569 — 9y
0
here Decemus 141 — 9y
0
Since it doesn't seem like you're modifying the datastore, why not just use :GetAsync? XAXA 1569 — 9y
0
This would work. BlueTaslem 18071 — 9y
View all comments (2 more)
0
Mind showing the whole script? XAXA 1569 — 9y
0
Alright Decemus 141 — 9y

Answer this question