Confusing UI help


I don’t really know whats happening, but here is the code:

local optionsIcon = TB.new()
optionsIcon:setImage("rbxassetid://7461499721")
optionsIcon:notify()

local shopIcon = TB.new()
shopIcon:setImage("rbxassetid://7461908280")
shopIcon:notify()

local creditsIcon = TB.new()
creditsIcon:setLabel("❔")
creditsIcon:notify()

--// Functions \\--

local function tween(instance, tinfo, properties)
	game:GetService("TweenService"):Create(instance, tinfo, properties):Play()
end

local function hideMenu(name, blur)
	if name == nil then
		for _, menu in pairs(script.Parent.BG:GetChildren()) do
			menu.Visible = false
			if blur then
				tween(game.Lighting.Blur, TweenInfo.new(0.3), {Size = 0})
			end
		end
	end
end

local function showMenu(name, blur)
	if name == nil then
		warn('No menu name specified.')
		return
	end
	
	local menu = script.Parent.BG:FindFirstChild(name)
	if not menu then 
		return warn "No menu found called"..name
	end
	
	hideMenu(nil)
	
	if blur then
		tween(game.Lighting.Blur, TweenInfo.new(0.3), {Size = 18})
	end
	menu.Visible = true
end

--// Do \\--
optionsIcon.deselected:Connect(function()
	hideMenu(nil, true)
end)
optionsIcon.selected:Connect(function()
	showMenu("Settings", true)
end)
shopIcon.deselected:Connect(function()
	hideMenu(nil, true)
end)
shopIcon.selected:Connect(function()
	showMenu("Shop", true)
end)
creditsIcon.deselected:Connect(function()
	hideMenu(nil, true)
end)
creditsIcon.selected:Connect(function()
	showMenu("Credits", true)
end)

In the video, when you select the shopIcon, your also deselecting the optionsIcon which is firing the hideMenu function that is turning all the menus invisible, not just the deselected menu. Hope that makes sense.