Sorry Bad English
I need help with ‘Table’ Datastore
Script
Save Script :
function Saved(plr)
local activated = {}
local Ds2
local function CheckSaved()
for i,v in pairs(plr.Stats:GetChildren()) do
if v:isA("NumberValue") then
Ds2 = DS:GetDataStore("DataSave123" .. v.Name)
table.insert(activated, v.Value)
end
end
end
CheckSaved()
local succes, errormessage = pcall(function()
Ds2:SetAsync(plr.UserId,activated)
end)
end
when i try to print the table, the output only sends me 1 print from player.Stats, While in Player.Stats there are 16 numbervalue.
Load Script :
function GetSaved(plr)
for i,v in pairs(script:GetChildren()) do
local Ds2 = DS:GetDataStore("DataSave123" .. v.Name)
local save = Ds2:GetAsync(plr.userId)
local newStat = Instance.new("NumberValue",plr.Stats)
newStat.Name = v.Name
newStat.Value = save or v.Value
end
end
The problem is my script doesn’t work on/doesn’t save player value
Anyone can help me with this script please.