Advertisement
Navarone19_CH

Leaderboard (SAVE)

Jan 5th, 2020
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. local dsService = game:GetService("DataStoreService")
  2. local ds = dsService:GetDataStore("MondStats") -- Change this with a random data name!
  3.  
  4. game.Players.PlayerAdded:Connect(function(plr)
  5. local folder = Instance.new("Folder", plr)
  6. folder.Name = "leaderstats"
  7. local currency = Instance.new("IntValue", folder)
  8. currency.Name = "Rebirth" -- Currency name.
  9. currency.Value = ds:GetAsync(plr.UserId) or 0
  10. currency.Changed:Connect(function()
  11. ds:SetAsync(plr.UserId, currency.Value)
  12. end)
  13. end)
  14.  
  15. game.Players.PlayerRemoving:Connect(function(plr)
  16. ds:SetAsync(plr.UserId, plr.leaderstats.Rebirth.Value) -- Replace 'Money' with your currency name!
  17. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement