I am trying to make it so that if the player has a specific value in a numberval (0) in their plrreasearchfolder it looks for viewportframes in a two different frames named the numberval so it can make a icon invisible if the value is THE specific one.
To the point of finding the names and values inside the player’s folder it works.
the second “Loop” doesn’t work.
local player = game.players.localplayer -- for example
local plrresearch = player.Research
local groups = script.Parent.Frame:FindFirstChild("Naval" and "Ground")
for _, v in pairs(plrresearch:GetChildren()) do
if v.Value == 0 then local names = v.Name -- works to this point
wait(0.1)
for _, e in pairs(groups:FindFirstAncestor(names)) do -- I tried many things here like "findfirstchild" or "FindfirstDescendant"
if e:IsA("ViewportFrame") then -- error on the loop "invalid argument #1 to 'ipairs' (table expected, got nil)"
local locked = names:FindFirstChild("Locked")
locked.Visible = false
end
end
end
end
Ok, your script has way more issues than I thought, and without seeing the hierachy of all the components (a screenshot of explorer), I cant really do much more:
local player = game.players.localplayer -- for example
local plrresearch = player.Research
local groups = {script.Parent.Frame:FindFirstChild("Naval"), script.Parent.Frame:FindFirstChild("Ground")}
for _, v in pairs(plrresearch:GetChildren()) do
if v.Value == 0 then
local names = v.Name -- works to this point
wait(0.1)
for _, i in ipairs(groups) do
for _, e in pairs(i:GetDescendants()) do
if e:IsA("ViewportFrame") and e.Name == names then
local locked = e:FindFirstChild("Locked")
locked.Visible = false
end
end
end
end
end
Note: You may need to modify the locked thing - I don’t got sufficient context about it to make sure it works