how do I save children from a folder to a data table?
Data I want to save:player.Pets:GetChildren()
Where I want to save the data to:DataObject[2]
Save data code:
game.Players.PlayerRemoving:Connect(function(player)
local DataObject = {player.leaderstats.Cash.Value, {}}
--Data I want to save: player.Pets:GetChildren()
--Where I want to save the data to: DataObject[2]
local success,fail = pcall(function()
print("Player data syncing")
Datastore:SetAsync(player.UserId.. "Data",DataObject)
end)
if success then
print("Data saved successfully: ", DataObject)
else
warn("Error saving data" ..fail)
end
end)