KashTheKingYT

Money Giver

Jun 19th, 2021
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. local giveMoney = game.ReplicatedStorage.GiveMoney
  2. local waitVar = game.ServerStorage.Wait
  3. local moneyToGive = 5000
  4. local waitMax = 5
  5.  
  6. function moneyFunc(plr)
  7.     if plr:FindFirstChild("leaderstats") then
  8.         plr.leaderstats.Cash.Value += moneyToGive
  9.     end
  10. end
  11.  
  12. giveMoney.OnServerInvoke = function(plr)
  13.     if waitVar.Value <= 0 then
  14.         moneyFunc(plr)
  15.         game.ServerStorage.Wait.Value = waitMax
  16.         return true, "+$"..moneyToGive
  17.     else
  18.         return false, "You must wait "..waitVar.Value.." more seconds."
  19.     end
  20. end
  21.  
  22. while wait() do
  23.     if game.ServerStorage.Wait.Value > 0 then
  24.         game.ServerStorage.Wait.Value -= 1
  25.         wait(1)
  26.     end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment