Hello, I tried doing a script to save datas on a table but something weird happens
a part of the script:
game.Players.PlayerRemoving:Connect(function(Player)
local StatsValue = {}
for _,v in pairs(game.ReplicatedStorage.Stats:GetChildren()) do
print(v.HasGot.Value)
local New = {['Material'] = v.Name, ['HowMuch'] = v.Value, ['Unlocked'] = v.HasGot.Value}
table.insert(StatsValue,New)
end
end)
And the value is actually printing "false" but when I want to insert it in "Unlocked" i get the error "HasGot is not a valid member of StringValue"
I don't understand why :(

3 comments
My script is different, he dosen't work like that because there is multiple Stats so there is a lot of table inside of the same table, wich is then saved inside Datastores with JSONEncode.
Well, if you try to print the contents of the table, it will be in encoded form and it cannot be decoded. That is why, I suggested you this method. You can only use table.insert in arrays.
Yes, but I don't think its the problem, because even if I print it again without adding it in a table or anything like that, it still diseapear like printing it would delete it