Help With Category Changer Avatar GUI

The lists folder contains frames and each frame has all of the items of one category. The script.Parent (aka button for changing which list is shown) has the same name as the corresponding list. The problem? When I click a category (example - Tops), it hides all lists even the tops list. No errors in the output either. Thanks for any help :nerd_face:

local Lists = script.Parent.Parent.Parent.Parent.Lists

script.Parent.MouseButton1Click:Connect(function()

	Lists[script.Parent.Name].Visible = true

	for _, object in pairs(Lists:GetDescendants()) do
		if object:IsA("Frame") then
			if object.Name ~= script.Parent.Name then
				object.Visible = false
			else
			end
		end
	end
end)

Can you provide a screenshot of the explorer and a code with print functions as debug? The print functions will help in understand where the code breaks, also did you check the output to see if there is any error?

1 Like

I checked output yeah

You are doing GetDescendants() you want to use GetChildren()

2 Likes

Sorry lol, I never notice such obvious mistakes

@Pure_Bacn is right, i didn’t notice the :GetDescendants(), basically if you use GetDescendants everything that is inside the the frame will be hidden as its name is not the one of the button.

1 Like