Sbot50

Untitled

Jul 27th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. local DataStore = game:GetService("DataStoreService") -- getting the data store
  2. local dsc = DataStore:GetDataStore("CashSaveSystem") -- making a new datastore
  3. local dsa = DataStore:GetDataStore("AbbosSaveSystem")
  4. local dsv = DataStore:GetDataStore("VidsSaveSystem")
  5.  
  6. game.Players.PlayerAdded:Connect(function(player)-- function when you join
  7. local leaderstats = Instance.new("IntValue")
  8. leaderstats.Name = "leaderstats"
  9. leaderstats.Parent = player
  10.  
  11. local Cash = Instance.new("IntValue", leaderstats)
  12. Cash.Name = "cash"
  13. Cash.Value = 0
  14. Cash.Parent = leaderstats
  15.  
  16. local Abbonees = Instance.new("IntValue",leaderstats)
  17. Abbonees.Name = "abbonees"
  18. Abbonees.Value = 0
  19. Abbonees.Parent = leaderstats
  20.  
  21. local Videos = Instance.new("IntValue",leaderstats)
  22. Videos.Name = "videos"
  23. Videos.Value = 0
  24. Videos.Parent = leaderstats
  25. dsc:SetAsync(player.UserId + "Cash", Cash.Value) -- saving the value
  26. Cash.Changed:connect(function() -- if the value changes
  27. dsc:SetAsync(player.UserId + "Cash", Cash.Value) -- saves the value
  28. dsa:SetAsync(player.UserId + "Abbos", Abbonees.Value) -- saving the value
  29. Abbonees.Changed:connect(function() -- if the value changes
  30. dsa:SetAsync(player.UserId + "Abbos", Abbonees.Value)
  31. dsv:SetAsync(player.UserId + "Vids", Videos.Value) -- saving the value
  32. Videos.Changed:connect(function() -- if the value changes
  33. dsv:SetAsync(player.UserId + "Vids", Videos.Value)
  34. end)
  35. end)
  36. end)
  37. end)
  38.  
  39. game.Players.PlayerRemoving:Connect(function(player) -- when you leave
  40. dsc:SetAsync(player.UserId + "Cash", player.leaderstats.Cash.Value) -- saving the value
  41. dsa:SetAsync(player.UserId + "Abbos", player.leaderstats.Abbonees.Value) -- saving the value
  42. dsv:SetAsync(player.UserId + "Vids", player.leaderstats.Videos.Value) -- saving the value
  43. end)
Add Comment
Please, Sign In to add comment