Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. local PointsData = game:GetService("DataStoreService")
  2. local ds = PointsData:GetDataStore("StrengthSaveSystem")
  3. local sd = PointsData:GetDataStore("RebirthSaveSystem")
  4. local sb = PointsData:GetDataStore("MoneySaveSystem")
  5.  
  6. game.Players.PlayerAdded:Connect(function(player)
  7. local leader = Instance.new("Folder",player)
  8. leader.Name = "leaderstats"
  9. local Strength = Instance.new("IntValue",leader)
  10. Strength.Name = "Strength"
  11. Strength.Value = ds:GetAsync(player.UserId) or 0
  12. local Rebirth = Instance.new("IntValue",leader)
  13. Rebirth.Name = "Rebirth"
  14. Rebirth.Value = sd:GetAsync(player.UserId) or 0
  15. local Money = Instance.new("IntValue",leader)
  16. Money.Name = "Money"
  17. Money.Value = sb:GetAsync(player.UserId) or 0
  18. ds:SetAsync(player.UserId, Strength.Value)
  19. Strength.Changed:connect(function()
  20. ds:SetAsync(player.UserId, Strength.Value)
  21. sd:SetAsync(player.UserId, Rebirth.Value)
  22. Rebirth.Changed:connect(function()
  23. sd:SetAsync(player.UserId, Rebirth.Value)
  24. sb:SetAsync(player.UserId, Money.Value)
  25. Money.Changed:connect(function()
  26. sb:SetAsync(player.UserId, Money.Value)
  27. end)
  28. end)
  29. end)
  30. end)
  31.  
  32.  
  33. game.Players.PlayerRemoving:connect(function(player)
  34. ds:SetAsync(player.UserId, player.leaderstats.Strength.Value)
  35. end)
  36.  
  37.  
  38. game.Players.PlayerRemoving:connect(function(player)
  39. sd:SetAsync(player.UserId, player.leaderstats.Rebirth.Value)
  40. end)
  41.  
  42.  
  43. game.Players.PlayerRemoving:connect(function(player)
  44. sb:SetAsync(player.UserId, player.leaderstats.Money.Value)
  45. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement