Frame visuality not changing back to false

for _,v in pairs(Buttons:GetChildren()) do
	if v:IsA("TextButton") then
		v.MouseButton1Click:Connect(function()
			for _,v in pairs(Frames:GetChildren()) do
				if v:IsA("Frame") then
					v.Visible = false
				end
			end
			local frame:Frame = Frames:FindFirstChild(v.Name)
			if frame then
				frame.Visible = not frame.Visible
			end
		end)
	end
end

https://gyazo.com/7f0c8cef3590c450313b7df9fd7e8106

Here, you set all frames to false. Meaning that on this line:

You set false to not false (aka true). Also, you are using v twice; try this code:

for _,v in pairs(Buttons:GetChildren()) do
	if v:IsA("TextButton") then
		v.MouseButton1Click:Connect(function()
			for _, frame in pairs(Frames:GetChildren()) do
				if frame:IsA("Frame") and frame.Name ~= v.Name then
					frame.Visible = false
				end
			end
			local frame:Frame = Frames:FindFirstChild(v.Name)
			if frame then
				frame.Visible = not frame.Visible
			end
		end)
	end
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.