Help With Crafting system

Hello! I need help with a crafting system where you need certain tools(they dont go away) to “fuse” into something else.

I only need help with the checking if the player has the required tools in the backpack, I thought about creating a table called “ingredients” and putting the names of each tool in the table(as strings). if this is the right way to do it, I still don’t know how to do the for loop.
So to sum it up I need help for the “checking if the player has the required tools” part of the crafting system.

Thank you! If you need the script tell me.

You are on the right track. That is definitely a way that would work.

local ingredients = {
   "tool1";
   "tool2";
   "tool3";
}

local hasIngredients = true

for i,v in pairs (ingredients) do
   if not playersBackpack:FindFirstChild(v) then -- define playersBackpack
        hasIngredients = false -- if the player does not have an ingredient it will set it to false
        break -- player does not have at least one of the ingredients, so you can end the loop
   end
end

if hasIngredients == true then
      --player has the ingredients
end
4 Likes