Hello Everyone,
I need help saving BoolValues using DataStores
this is my current code for saving data and loading data:
game.Players.PlayerRemoving:Connect(function(player)
– SAVING DATA
local mainFolder = player:WaitForChild("TwitterCodes")
if mainFolder then
local saveCodes = {}
for i,v in pairs(mainFolder:GetChildren()) do
saveCodes[v.Name] = v.Value
end
codesDataStore:SetAsync(player.UserId,saveCodes)
end
– LOADING DATA
local mainFolder = player:WaitForChild(“TwitterCodes”)
local codeData = codesDataStore:GetAsync(player.UserId)
if codeData then
for i,v in pairs(mainFolder:GetChildren()) do
v.Value = codeData[v.Value]
end
end
This does not save my boolValues and I don’t know what I did wrong.
I did a print check to check the saveCodes table value and [1] and [2] slots of the table were nil!
I’m not that good with saving tables, I would appreciate it if anyone helps.