I want to check if a folder has a specific item. How would I do that?
I’ve tried doing this:
for i, item in ipairs(inventory:GetChildren("Sword"))do
if item.Name == "Sword" then
itemOwned = true
else
itemOwned = false
end
In this code sample the folder is saved in a variable named inventory and I’m trying to check if there is a tool named “Sword” in that folder.
This code sample doesn’t work because it gives the error of “attempt to call nil value”. If someone knows a post that has the answer to this question can you link it to me because I cannot find a post that does. If there is no post that answers that question does anyone know the answer to the question?