Advertisement
Sungmingamerpro13

Stacks System

Oct 29th, 2024
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.87 KB | None | 0 0
  1. local Medkit = script.Parent
  2. local MaxStock = 10
  3.  
  4. local StockGui = Medkit.StockGui
  5.  
  6. Medkit.ClickDetector.MouseClick:Connect(function(player)
  7.    
  8.     MaxStock -= 1
  9.    
  10.     StockGui.stockLabel.Text = "Stock: "..MaxStock
  11.    
  12.     if MaxStock == 0 then
  13.         Medkit.BrickColor = BrickColor.new("Really red")
  14.         StockGui.stockLabel.Text = "Out of Stock"
  15.     end
  16.    
  17.     if not player.Backpack:FindFirstChild("Name Here") then
  18.         game.ServerStorage.Foods.Medkit:Clone().Parent = player.Backpack
  19.     end
  20.    
  21.     if player.Backpack:FindFirstChild("Name Here") then
  22.         player.Backpack:FindFirstChild("Name Here").stacks.Value += 1
  23.     end
  24. end)
  25.  
  26. Medkit.ProximityPrompt.Triggered:Connect(function(player)
  27.    
  28.     if player.Coins.Value >= 100 then
  29.         player.Coins.Value = player.Coins.Value - 100
  30.         MaxStock += 10
  31.         Medkit.BrickColor = BrickColor.new("White")
  32.         StockGui.stockLabel.Text = "STOCK: "..MaxStock
  33.     end
  34. end)
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement