Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Finding all Frames then turning them invisible help?

Asked by 10 years ago

Hello. I have gotten a lot more experienced at scripting now but I have doubts about this script. Here it is,

for i, v in pairs(script.Parent.Parent:GetChildren()) do -- find all screengui's
    for k, r in pairs(v:GetChildren()) do -- find all frames
        if r:IsA("Frame") then -- if a frame then
            r:IsA("Frame").Visible = false -- turn it invisible
        end
    end
end

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

Your code will only find Frames directly inside of ScreenGuis, not any Frames within those Frames.

Now, assuming that's intentional, your problem is line 4 in the above. The IsA method returns true or false. Booleans do not have a Visible property, you want to modify the property on the Frame itself. Simply change line 4 to this:

r.Visible = false
0
Thank you. raystriker6707 30 — 10y
Ad

Answer this question