Advertisement
Guest User

leaderstats

a guest
Jun 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1.  
  2. PointData = game:GetService("DataStoreService"):GetDataStore("PointData")
  3. PrestigeData = game:GetService("DataStoreService"):GetDataStore("PrestigeData")
  4.  
  5. game.Players.PlayerAdded:Connect(function(plr)
  6. local LB = Instance.new("IntValue")
  7. LB.Name = "leaderstats"
  8.  
  9. local p = Instance.new("IntValue")
  10. p.Name = "Points"
  11. p.Value = PointData:GetAsync(plr.userId) or 0
  12.  
  13. local r = Instance.new("IntValue")
  14. r.Name = "Prestige"
  15. r.Value = PrestigeData:GetAsync(plr.userId) or 0
  16.  
  17. LB.Parent = plr
  18. p.Parent = LB
  19. r.Parent = LB
  20. end)
  21.  
  22. game.Players.PlayerRemoving:Connect(function(plr)
  23. PointData:SetAsync(plr.userId, plr.leaderstats.Points.Value)
  24. PrestigeData:SetAsync(plr.userId, plr.leaderstats.Prestige.Value)
  25. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement