qwopqwoqpwqwop

Untitled

Nov 2nd, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. local DSS = game:GetService("DataStoreService"):GetDataStore("Test")
  2.  
  3. function getKey(plr)
  4. local key = "id_"..plr.UserId
  5. return key
  6. end
  7.  
  8. function generateDTable(plr)
  9. local data = {
  10. Val = plr.leaderstats.val.Value
  11. }
  12. return data
  13. end
  14.  
  15. function saveData(plr)
  16. local key = getKey(plr)
  17. local data = generateDTable(plr)
  18. DSS:SetAsync(key, data)
  19. end
  20.  
  21. function loadData(plr)
  22. local key = getKey(plr)
  23. local data = DSS:GetAsync(key)
  24. giveData(plr,data)
  25. end
  26.  
  27. function giveData(plr, data)
  28. plr.leaderstats.Val.Value = data.Val
  29. end
Advertisement
Add Comment
Please, Sign In to add comment