I have settings as multiple values divided in different sections with folders. However, while attempting to save the values, Ive come across an issue. I can only save one value at a time. (mind you, im new to data store.)
local plr = game.Players.LocalPlayer
local dataStore = game:GetService("DataStoreService")
local mainStore = dataStore:GetDataStore("Main")
local success,data = pcall(function()
return mainStore:GetAsync(plr.UserId)
end)
if success then
for i, v in pairs(script:GetChildren()) do
for ia, z in pairs(v:GetChildren()) do
if z:IsA("ValueBase") then
z.Value = data or z.Value
end
end
end
else
print("failed to load data, rip man")
end
game.Players.PlayerRemoving:Connect(function(pla)
if pla == plr then
local success,err = pcall(function()
return mainStore:SetAsync(plr.UserId)
end)
end
end)
I stopped writing the code once i encountered this problem
Im not entirely sure how to explain my layout any further, so heres a screenshot to give you an idea.