Advertisement
Sungmingamerpro13

Food Stock 3

Jul 3rd, 2024 (edited)
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.27 KB | None | 0 0
  1. local CashGui = script.Parent.CashGui
  2.  
  3. local Number = 100
  4. local MaxNumber = 30
  5.  
  6. CashGui.CashFrame.stockLabel.Text = "STOCK: "..MaxNumber
  7.  
  8. script.Parent.ClickDetector.MouseClick:Connect(function(player)
  9.    
  10.     if not player.Backpack:FindFirstChild("Cookie") then
  11.         if player.Coins.Value >= Number then
  12.             player.Coins.Value = player.Coins.Value - Number
  13.  
  14.             game.ServerStorage.Foods.Cookie:Clone().Parent = player.Backpack
  15.             MaxNumber = MaxNumber - 1
  16.  
  17.             CashGui.CashFrame.stockLabel.Text = "STOCK: "..MaxNumber
  18.         end
  19.     else
  20.         if player.Coins.Value >= Number then
  21.             player.Coins.Value = player.Coins.Value - Number
  22.  
  23.             player.Backpack:FindFirstChild("Cookie").stacks.Value += 1
  24.             MaxNumber = MaxNumber - 1
  25.  
  26.             CashGui.CashFrame.stockLabel.Text = "STOCK: "..MaxNumber
  27.         end
  28.     end
  29.    
  30.     while wait() do
  31.         if MaxNumber == 0 then
  32.             script.Parent.ClickDetector.MaxActivationDistance = 0
  33.             CashGui.CashFrame.stockLabel.Text = "STOCK: "..MaxNumber
  34.             wait(1)
  35.             break
  36.         end
  37.     end
  38.    
  39. end)
  40.  
  41.  
  42.  
  43. script.Parent.ClickDetector.MouseHoverEnter:Connect(function()
  44.     script.Parent.SelectionBox.Visible = true
  45.     CashGui.Enabled = true
  46. end)
  47.  
  48. script.Parent.ClickDetector.MouseHoverLeave:Connect(function()
  49.     script.Parent.SelectionBox.Visible = false
  50.     CashGui.Enabled = false
  51. end)
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement