Interesting UI bug... Need help fixing

Greetings! I have a UI Framework, and for some reason, my settings UI works just fine, but not my Shop or Inventory UI.

Basically the issue is that the shop doesn’t want to close the UI when I switch the UI, but the Settings does even though the systems are very similar.

Settings:

image

Shop and Inventory:

The LocalScript inside of UI > Sidebar > Selection are identical. They are:

local TweenService = game:GetService("TweenService")
local FadeInfo = TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false)

for _, Buttons in script.Parent:GetChildren() do
	if Buttons:IsA("TextButton") then
		Buttons.MouseButton1Click:Connect(function()
			for _, Buttons2 in script.Parent:GetChildren() do
				if Buttons2:IsA("TextButton") then
					if Buttons2 ~= Buttons then
						TweenService:Create(Buttons2, FadeInfo, {BackgroundTransparency = 1}):Play()
					end
				end
			end

			for _, Frames in script.Parent.Parent.Parent.Frames:GetChildren() do
				if Frames:IsA("Frame") then
					Frames.Visible = false
				end
			end

			script.Parent.Parent.Parent.Frames[Buttons.Name].Visible = true
			TweenService:Create(Buttons, FadeInfo, {BackgroundTransparency = 0}):Play()
		end)
	end
end

Not sure what my issue is.

If you need more info, that will be appreciated.

Thanks in advance!

Does clicking the close button on the settings frame also close the shop?

No, I am talking about these side buttons.

Settings:

image

Shop:

image

Switching the Settings menu works just fine and closes the UI.

Can’t say the same about the shop:

Well, there’s no error. It doesn’t appear that you added the sidebar transparency in the first place.

Found the issue. I was using ScrollingFrames instead of Frames in the Shop.