When i try to make multiple Gui's invisible, nothing happens. I don't really know what i'm doing here but i know it doesn't seem right. Does anyone know what i'm doing wrong here?

Script location: This script > ScreenGui > Script > PlayerGui

for i, g in pairs(script.Parent.Parent.Parent:GetChildren()) do
if g:FindFirstChildOfClass("ScreenGui") then
if g:FindFirstChildOfClass("ScreenGui"):FindFirstChildOfClass("TextButton") then
g:FindFirstChildOfClass("ScreenGui"):FindFirstChildOfClass("TextButton").Visible = false
end
end
end
--Removed indentation due to the script being too long for the website

I get an error saying Error occured, no output from Lua on Line 2

10 comments

0

Indent your code please.

0

I removed it because the text comes out of the code block.

0

Fair enough

0

Is this a localscript?

0

Is this the full script?

0

This is a LocalScript and no this isn't the full script, but there's nothing else in the script that affects this.

0

If this isn't the full script then that error could possibly not be related to this bit of code because it says line 2.

0

No, i put line 2 because the error comes from that line. In the real script it says Line 10 but i know what i'm doing here.

0

You can make the GUIs invisible by disable the main parent.

0

I know, i did that instead.