Sbot50

Untitled

Jul 31st, 2019
826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.10 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 successcash, cash = pcall(function()
  8.     return dsc:GetAsync(player.UserId .. "Cash")
  9.         end)
  10.     if successcash then
  11.             print("cash sucseeded")
  12.         end
  13.     local successabbos, abbonees = pcall(function()
  14.     return dsc:GetAsync(player.UserId .. "Abbos")
  15.         end)
  16.     if successabbos then
  17.             print("abbos sucseeded")
  18.         end
  19.     local successvids, videos = pcall(function()
  20.     return dsc:GetAsync(player.UserId .. "Vids")
  21.             end)
  22.     if successvids then
  23.             print("vids sucseeded")
  24.         end
  25.     local leaderstats = Instance.new("IntValue")
  26.     leaderstats.Name = "leaderstats"
  27.     leaderstats.Parent = player
  28.    
  29.     local cash = Instance.new("IntValue")
  30.     cash.Name = "cash"
  31.     cash.Value = -1
  32.     if successcash then
  33.        cash.Value = successcash
  34.     else
  35.       warn(cash)
  36.     end
  37.     cash.Parent = leaderstats
  38.    
  39.     local abbonees = Instance.new("IntValue")
  40.     abbonees.Name = "abbonees"
  41.     abbonees.Value = -1
  42.     if successabbos then
  43.        abbonees.Value = abbonees
  44.     else
  45.       warn(abbonees)
  46.     end
  47.     abbonees.Parent = leaderstats
  48.    
  49.     local videos = Instance.new("IntValue")
  50.     videos.Name = "videos"
  51.     videos.Value = -1
  52.     if successcash then
  53.        videos.Value = videos
  54.     else
  55.       warn(videos)
  56.     end
  57.     videos.Parent = leaderstats
  58.     end)
  59.  
  60. game.Players.PlayerRemoving:Connect(function(player) -- when you leave
  61.     dsc:SetAsync(player.UserId.. "Cash", player.leaderstats.cash.Value) -- saving the value
  62.     dsa:SetAsync(player.UserId.. "Abbos", player.leaderstats.abbonees.Value) -- saving the value
  63.     dsv:SetAsync(player.UserId.. "Vids", player.leaderstats.videos.Value) -- saving the value
  64.     print("Cash:".. player.leaderstats.cash.Value)
  65.     print("Abbos:".. player.leaderstats.abbonees.Value)
  66.     print("vids:".. player.leaderstats.videos.Value)
  67.     print(player.UserId.. "Cash")
  68. end)
Advertisement
Add Comment
Please, Sign In to add comment