I'm making a crafting system and I can't figure out how to see if a player has two of the same tool in their backpack.
Iterating through the backpack and keeping tally should do fine for this.
local backpack = game.Players.LocalPlayer.Backpack local function getToolCount(toolName) local toolCount = 0 for i, child in pairs(backpack:GetChildren()) do if child:IsA("Tool") and child.Name == toolName then toolCount = toolCount + 1 end end return toolCount end -- eg: local swordsInBackack = getToolCount("Sword")