So i recently tried making stats using Tables and using DataStores with them and everything works perfectly but when i use a for loop to create the stats it doesn't load the stats correctly.

for StatName, Value in pairs(StatsValues) do
		local svalue = Instance.new("IntValue",stats)
		svalue.Name = StatName
		svalue.Value = DataStoreService:GetDataStore(Store):GetAsync(Player.UserId) or Value
	end

From what i've heard it's because it only loads the data from the very first value of the table.

What i mean is: I have 3 or more stats in one table. the first stat is set to false but the rest is set to true. It'll only load the data of the first stat saying every value is false

2 comments

0

Are you testing it in studio? I believe testing in studio doesn't save anything to datastores.

0

Actually, they do if you don't set any other parameters