Advertisement
404Coder

leaderstats with datastore probably shit

Dec 21st, 2022
408
-1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.14 KB | None | 0 1
  1. local player = game.Player.PlayersAdded:Connect(function(Players)
  2.       local leaderstats = Instance.new("Folder")
  3.      
  4.         local leaderstats = Instance.new("CurrencyName")
  5.         leaderstats.Name = 'leaderstats'
  6.             leaderstats.Parent = Player
  7.        
  8.         local Clicks = Instance.new("CurrencyName")
  9.         Clicks.Name = Clicks
  10.         Clicks.Parent = Player
  11.         Clicks.Value = 0
  12.         end)
  13.  
  14. game.PlayerOnRemoving = game.Player.PlayerOnRemoving:GetService(function(DataStore)
  15.         local DS = Game.PlayerOnRemoving:GetAsync(UserId, CurrencyId)
  16.         if DS == Id then
  17.             local DataStore = game.DataStore:GetService("PlayerOnRemoving, PlayerId, UserId")
  18.             print("Player Removed From Game And Sucessfully Saved Data")
  19.             if not Player == DS then
  20.                game.Player.OnRemoving = game:GetService()
  21.                 print("Unsucessfully Saved Data")
  22.                
  23.                 coins.Table = for _ in next i,v(Table.Async.Data[#1])
  24.                
  25.                 Currnecy.Name = "Coins"   --change the currency value name to any currency you want--
  26.             end
  27.         end)
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement