I already find this [https://devforum.roblox.com/t/folder-getchildren-datasave/284730] but i dont know how to use this informations to make a working script. I cant save all my values one by one cause i have 18 values... My save script (for one value) actually look like this:
local DSS = game:GetService("DataStoreService")
local PlayerCash = DSS:GetDataStore("Money")
wait(0.04)
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Cash = Player.Folder.Money
Cash.Value = PlayerCash:GetAsync(Player.userId) or 0
game.Players.PlayerRemoving:connect(function(Player)
PlayerCash:SetAsync(Player.userId, Cash.Value)
end)
while true do
wait(70)
PlayerCash:SetAsync(Player.userId, Cash.Value)
end
end)
end)
and i currently trying to mix it with this (to hold more values) :
--Saving data
local dataToSave = {}
for i,v in pairs(playerFolder:GetChildren()) do
table.insert(dataToSave, v.Name)
end
--Save the table to a key
dataStore:UpdateAsync(key, function(oldValue)
--Do some kind of check if you want
return dataToSave
end)
--Loading data
local loadedData = --Load data from key
local loadedData = dataStore:GetAsync(key) --Example
for i,v in pairs(loadedData) do
local n = Instance.new('Folder')
n.Name = v
n.Parent = playerFolder
end

1 comment
Sorry for my bad english