I am trying to load in values from a datastore table. I can successfuly print out the saved values but for some reason when it get's to the for loop I get the error "attempt to index local 'v' (a number value). All of my values are int's except for two which are bith string's.
--Get The Service's local replicatedStorage = game:GetService("ReplicatedStorage") local timePlayedValue = replicatedStorage.PlayerStats:WaitForChild("TimePlayedValue") local totalTimeValue = replicatedStorage.PlayerStats:WaitForChild("TotalTimeValue") local httpsService = game:GetService("HttpService") local dsService = game:GetService("DataStoreService") local mainStore = dsService:GetDataStore("MainDataStore") --Get The Gameplay Stats local CompletedMissionsValue = game:GetService("ReplicatedStorage").GamePlayStats:WaitForChild("CompletedMissionsValue") local FailedMissionsValue = game:GetService("ReplicatedStorage").GamePlayStats:WaitForChild("FailedMissionsValue") local PreviousMissionValue = game:GetService("ReplicatedStorage").GamePlayStats:WaitForChild("PreviousMissionValue") local TimesDiedValue = game:GetService("ReplicatedStorage").GamePlayStats:WaitForChild("TimesDiedValue") local TrapsAvoidedValue = game:GetService("ReplicatedStorage").GamePlayStats:WaitForChild("TrapsAvoidedValue") local TrapsFailedValue = game:GetService("ReplicatedStorage").GamePlayStats:WaitForChild("TrapsFailedValue") --Get The PlayerStats local CoinsValue = replicatedStorage.PlayerStats:WaitForChild("Coins") local DateFirstJoinedValue = replicatedStorage.PlayerStats:WaitForChild("DateFirstJoinedValue") local RankValue = replicatedStorage.PlayerStats:WaitForChild("Rank") local ExperienceValue = replicatedStorage.PlayerStats:WaitForChild("XP") --Table To Store Data --Increment Time Values incrementor = coroutine.create(function() while wait(1) do timePlayedValue.Value = timePlayedValue.Value + 1 totalTimeValue.Value = totalTimeValue.Value + 1 end end) coroutine.resume(incrementor) --FIX DATASTORE game:GetService("Players").PlayerRemoving:Connect(function(player) AllStatsTable = {CompletedMissionsValue.Value, FailedMissionsValue.Value, PreviousMissionValue.Value, TimesDiedValue.Value, TrapsAvoidedValue.Value, TrapsFailedValue.Value, CoinsValue.Value, DateFirstJoinedValue.Value, RankValue.Value, ExperienceValue.Value, totalTimeValue.Value} local success, err = pcall(function() mainStore:SetAsync(player.UserId,AllStatsTable) end) if err then print("error saving") end end) game:GetService("Players").PlayerAdded:Connect(function(player) local success, err = pcall(function() local data = mainStore:GetAsync(player.UserId) if data then for i,v in pairs(data) do AllStatsTable[i] = v[i] end else print("no data") end end) if err then print("error loading data") end end)