GetChildren on GUI doesn't works?

Hello Roblox Dev Community,

Info
I got a problem when i was scripting my game for a UI Interface.
I am getting no error or anything else. It just doesn’t works.
I have tried multiple ways of fixing it. Like:

  • Changing the (if’s)
  • Checking my script if i made spelling mistakes multiple times
  • Checking if i got those frames in the UI
  • Checking if it didn’t selected any other things

So i basicily did some stuff here to try and fix it.

Info About Script and UI Interface
1. for _, tab in pairs(Tabs:GetChildren()) do
2.	tab.MouseButton1Down:Connect(function()
3.		local frame = ShopBackground:FindFirstChild(tostring(tab.TabName.Value).."MainLayout")
4.		if frame.Visible == false then
5.			frame.Visible = true
6.			for i, randomMainLayoutFrame in pairs(ShopBackground:GetChildren()) do
7.				print("Check1")
8.				if not randomMainLayoutFrame.Name == tostring(tab.TabName.Value).."MainLayout" then
9.					print("Check2")
10.					randomMainLayoutFrame.Visible = false
11.				end
12.			end
13.		end
14.	end)
15.end

The numbers that are showed here aren’t in the real script. These numbers are the lines, so it’s easier to understands stuff.

image

The Problem
So the problem here is that on Line 9, it doesn’t prints or like. It doesn’t comes that far
On line 8 i look if the frame is not the frame we have opened earlier.
On line 7 i have also putted a print, but that print the game does fire?

I really don’t know how to fix this problem. I would really love solutions from people so feel free to comment.

Cya!
:wave: :wave:

3 Likes

I have tried a different method and it worked, sorry for bothering.

2 Likes