CCCPaste

Burger with Stacks

function MouseHoverEnter()
    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
        local CashAmount = 5
        script.Parent.CashGui.CashLabel.Text = CashAmount.." Cash"
        script.Parent.CashGui.Enabled = true
    end
end

function MouseHoverLeave()
    if script.Parent:FindFirstChild("SelectionBox") then
        script.Parent.SelectionBox:Destroy()
        script.Parent.CashGui.Enabled = false
    end
end

function ClickOnPart(player)
    local AddMoney = 5
	if player.Money.Value >= AddMoney then
		player.Money.Value = player.Money.Value - AddMoney

		if not player.Backpack:FindFirstChild("Burger") then
			game.ServerStorage.Foods:FindFirstChild("Burger"):Clone().Parent = player.Backpack
		end
	else
        player.Money.Value = player.Money.Value - AddMoney

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

script.Parent.ClickDetector.MouseHoverEnter:Connect(MouseHoverEnter)
script.Parent.ClickDetector.MouseHoverLeave:Connect(MouseHoverLeave)
script.Parent.ClickDetector.MouseClick:Connect(ClickOnPart)