CCCPaste

Cupcake with Stacks

script.Parent.ClickDetector.MouseHoverEnter:Connect(function()
	if not script.Parent:FindFirstChild("SelectionBox") then
		local SelectionBox = Instance.new("SelectionBox")
		SelectionBox.Adornee = script.Parent
		SelectionBox.Parent = script.Parent
		SelectionBox.Color3 = Color3.new(1, 1, 1)
		SelectionBox.Transparency = 0.8
	end
end)

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	if player.Money.Value >= 10 then
		player.Money.Value = player.Money.Value - 10
		
		if not player.Backpack:FindFirstChild("Cupcake") then
			game.ServerStorage.Foods.Cupcake:Clone().Parent = player.Backpack
		end
	else
        player.Money.Value = player.Money.Value - 10

		if player.Backpack:FindFirstChild("Cupcake") then
			player.Backpack:FindFirstChild("Cupcake").stacks.Value += 1
		end
	end
end)