Advertisement
YT_PatricioTGN

Leaderstats

Dec 24th, 2020
1,134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. game.Players.PlayerAdded:Connect(function(Plr)
  2.     local stats = Instance.new("Folder", Plr)
  3.     stats.Name = "leaderstats"
  4.    
  5.     local Money = Instance.new("IntValue", stats)
  6.     Money.Name = "Money"
  7.     Money.Value = 0
  8. end)
  9.  
  10. game.ReplicatedStorage.AddExp.OnServerEvent:Connect(function(plr)
  11.     plr.leaderstats.Exp.Value = plr.leaderstats.Exp.Value + 50
  12. end)
  13.  
  14. game.Players.PlayerAdded:Connect(function(plr)
  15.     wait(.1)
  16.     local exp = plr.leaderstats.Exp
  17.     local levels = plr.leaderstats.Levels
  18.    
  19.     while wait() do
  20.         if exp.Value >= (100 * (levels.Value + 1)) then
  21.             levels.Value = levels.Value + 1
  22.             exp.Value = 0
  23.             game.ReplicatedStorage.LevelUpGui:FireClient(plr)
  24.         end
  25.     end
  26. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement