Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. local drink = script.Parent.Parent.abc
  2. local spot = script.Parent.Parent.Holder
  3. local db = false
  4. moneyToGive = 100
  5. debounce = false
  6.  
  7. function onClick(click)
  8.  
  9. debounce = false
  10. script.Parent.ClickDetector.MouseClick:connect(function(hit)
  11. if debounce == true then
  12. return
  13. end
  14. player = hit
  15. if player == nil then
  16. return
  17. end
  18. stat = player:findFirstChild("leaderstats")
  19. if stat == nil then
  20. return
  21. end
  22. cash = stat:findFirstChild("Cash")
  23. if cash == nil then
  24. return
  25. end
  26. if cash.Value < 1 then -------- IF MONEY <1 THEN RETURN ? LOOKS LIKE IT WORK BUT I CAN STILL PRESS THE BUTTON
  27. return
  28. end
  29. debounce = true
  30. cash.Value = cash.Value - moneyToGive -------- GIVE MONEY
  31. wait()
  32. debounce = false
  33. end)
  34.  
  35.  
  36. if db == false then
  37. db = true
  38.  
  39.  
  40.  
  41. local d = drink:clone() -------- CLONE THE DRINK WHEN BUTTON PRESS
  42. d.Handle.Position = spot.Position
  43. d.Parent = game.Workspace
  44. d.Handle.Anchored = false
  45. d.Name = "7up"
  46. wait(5)
  47. db = false
  48. end
  49. end
  50.  
  51. script.Parent.ClickDetector.MouseClick:connect(onClick)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement