Nope, I’m trying to do it. Still haven’t made much progress.
since there is no error, I assume it is if not craftable.Name == "Template" then
which is causing the problem. Try putting a print right after, see if it outputs anything?
Ok, I removed the if not statement and it fixed the craftable being visible when it shouldn’t be, but when I got the correct materials and the correct amount, the frame was still not visible.
Can I see the code? (30 thing)
yeah
for _, craftable in pairs(Main[nameOfTab].Inventory:GetChildren()) do -- list of craftables
if benchModule[craftable.Name] then
for i, requirements in pairs(benchModule[craftable.Name]) do -- requirements for crafting the craftable
for _, item in pairs(Player.Inventory:GetChildren()) do -- player inventory
local check = 0 -- check counter
if item.Name == requirements[1] and item.Value >= requirements[2] then
check = check + 1
end
if check == #requirements then
print("hi")
craftable.Visible = true
else
craftable.Visible = false
end
end
end
end
end
Try this, not tested, so might not work, but in theory it should
for _, craftable in pairs(Main[nameOfTab].Inventory:GetChildren()) do -- list of craftables
if not craftable.Name == "Template" then
local visible = true
for _, requirements in pairs(benchModule[craftable.Name]) do -- requirements for crafting the craftable
local item = Player.Inventory:FindFirstChild(requirements[1]) -- find item in player inventory
if item then -- check if numvalue is in player inventory, and isn't nil
if item.Value < requirements[2] then -- check if player has less than needed
visible = false -- set visible to false
end
end
end
craftable.Visible = visible -- set visibility
end
end
Still has the problem. Visible when it shouldn’t be.
Um, I really have no idea then. I guess if you send a rblx file over I could try to take a look, but otherwise sorry I couldn’t help.
Oh, nevermind, I solved it myself. Really funky solution but it works.
I added a bunch of debounces and removed the if not statement.
Thanks for the help though!
for _, craftable in pairs(Main[nameOfTab].Inventory:GetChildren()) do -- list of craftables
if canLoop2 then
canLoop2 = false
if benchModule[craftable.Name] then
local visible = true
for _, requirements in pairs(benchModule[craftable.Name]) do -- requirements for crafting the craftable
if canLoop3 then
canLoop3 = false
local item = Player.Inventory:FindFirstChild(requirements[1]) -- find item in player inventory
if item then -- check if numvalue is in player inventory, and isn't nil
if item.Value < requirements[2] then -- check if player has less than needed
visible = false -- set visible to false
end
end
end
canLoop3 = true
end
craftable.Visible = visible -- set visibility
end
end
canLoop2 = true
end
Can’t really call what I did help, but I’m glad you figured it out : )