Need help modifying this script

Greetings all. As you can see this script makes people purchase food using ingame money. The thing is, I now want it to use other tools to purchase, meaning for example they would need a “Yeast”, and “Flour” tool in their inventory in order for the “Bread” item to enter their backpack. How should I go about doing this?

gps = game:GetService("GamePassService")

player = script.Parent.Parent.Parent.Parent.Parent
Wallet = player.beaderbats.Credit
price = 250
tool = game.ReplicatedStorage:findFirstChild("Bread")


function buy()
	if Wallet.Value >= price then
		Wallet.Value = Wallet.Value - price
		local a = tool:clone()
		a.Parent = player.Backpack


	end
end
script.Parent.MouseButton1Down:connect(buy)

You can check the player’s backpack for a specific name, to see if they have it:

local Tools = {"Yeast", "Flour"}

local function hasTools(player)
    for _, toolName in Tools do
        if not player.Backpack:FindFirstChild(toolName) and not player.Character:FindFirstChild(toolName) then
            return false
        end
    end
    return true
end

this will return true if the player owns the tool, false if not.

Use it inside your buy function this way:

if Wallet.Value >= price and hasTools(player) then
local function AddTool(tool: Tool, Backpack: Backpack)
    local a = tool:Clone()
    a.Parent = Backpack
    return a
end