CCCPaste

Stacks System

local Medkit = script.Parent
local MaxStock = 10

local StockGui = Medkit.StockGui

Medkit.ClickDetector.MouseClick:Connect(function(player)
	
	MaxStock -= 1
	
	StockGui.stockLabel.Text = "Stock: "..MaxStock
	
	if MaxStock == 0 then
		Medkit.BrickColor = BrickColor.new("Really red")
		StockGui.stockLabel.Text = "Out of Stock"
	end
	
	if not player.Backpack:FindFirstChild("Name Here") then
		game.ServerStorage.Foods.Medkit:Clone().Parent = player.Backpack
	end
	
	if player.Backpack:FindFirstChild("Name Here") then
		player.Backpack:FindFirstChild("Name Here").stacks.Value += 1
	end
end)

Medkit.ProximityPrompt.Triggered:Connect(function(player)
	
	if player.Coins.Value >= 100 then
		player.Coins.Value = player.Coins.Value - 100
		MaxStock += 10
		Medkit.BrickColor = BrickColor.new("White")
		StockGui.stockLabel.Text = "STOCK: "..MaxStock
	end
end)