Advertisement
drakon-firestone

Untitled

Nov 5th, 2023
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. local function SaveData(player)
  2. local data = {}
  3. local count = 0
  4. local success, errorMsg = pcall(function()
  5. for i, folder in pairs(player:GetChildren()) do
  6. data[folder.Name] = {}
  7. for i, item in pairs(folder:GetChildren()) do
  8. data[folder.Name][item.Name] = item.Value
  9. end
  10. end
  11. dataStore:SetAsync(player.UserId .. key, data)
  12. end)
  13. if not success then
  14. warn(errorMsg)
  15. wait(5)
  16. SaveData(player)
  17. end
  18. print("Saved data")
  19. print(data)
  20. end
  21.  
  22.  
  23.  
  24.  
  25. players.PlayerRemoving:Connect(SaveData)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement