CCCPaste

Food Stocks

local Food = script.Parent

local Stock = 100

Food.CashGui.stockLabel.Text = "Stock: "..Stock

Food.ClickDetector.MouseClick:Connect(function(player)
	if player.Coins.Value >= 150 then
		player.Coins.Value = player.Coins.Value - 150

		Stock = Stock - 1

		Food.CashGui.stockLabel.Text = "Stock: "..Stock

		if not player.Backpack:FindFirstChild("Cupcake") then
			game.ServerStorage.Foods.Chips:Clone().Parent = player.Backpack
		end
	else
		Food.CashGui.cashLabel.Text = "Insufficient Coins"
		wait(2)
		Food.CashGui.cashLabel.Text = "100 Coins"
	end
end)

Food.ClickDetector.MouseHoverEnter:Connect(function()
	Food.SelectionBox.Visible = true
end)

Food.ClickDetector.MouseHoverLeave:Connect(function()
	Food.SelectionBox.Visible = false
end)