Fr4st3yyt

For MYSQUAD

Jan 23rd, 2023
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. local ds = game:GetService("DataStoreService"):GetGlobalDataStore()
  2. game.Players.PlayerAdded:Connect(function(plr)
  3. wait()
  4. local plrkey = "id_"..plr.UserId
  5. local save1 = plr.leaderstats.Wins
  6. local save2 = plr.leaderstats.Deaths
  7. local save3 = plr.leaderstats.Kills
  8.  
  9.  
  10. local Saved = ds:GetAsync(plrkey)
  11. if Saved then
  12. save1.Value = Saved[1]
  13. save2.Value = Saved[2]
  14. save3.Value = Saved[3]
  15. else
  16. local NumberForSaving = {save1.Value,save2.Value,save3.Value}
  17. ds:GetAsync(plrkey, NumberForSaving)
  18. end
  19. end)
  20.  
  21. game.Players.PlayerRemoving:Connect(function(plr)
  22. ds:SetAsync("id_"..plr.UserId, {plr.leaderstats.Wins.Value,plr.leaderstats.Deaths.Value,plr.leaderstats.Kills.Value})
  23. end)
Advertisement
Add Comment
Please, Sign In to add comment