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 :(
Well, I am not sure what is causing the HasGot
not the member of StringValue
. But, other from that, there is a major issue. You cannot add Dictionaries
to the table using table.insert
. the following code might help :
game.Players.PlayerRemoving:Connect(function(Player) local StatsValue = {} for _, v in pairs(game.ReplicatedStorage.Stats:GetChildren()) do print(v.HasGot.Value) StatsValue['Material'] = v.Name StatsValue['HowMuch'] = v.Value StatsValue['Unlocked'] = v.HasGot.Value end end)
If the problem related to HasGot
further continues, please comment and lemme know. If you want realtime help, you can ask for my discord DM.