Disabled TextButton after Frame Open

I’m currently trying to make it so that whenever the Frame is opened, all the textbuttons are non-clickable and other frames can’t be open. I’ve tried using BoolValue and lots more and so far nothing has worked.

Any help would be great! :slight_smile:

Example: I open a textbutton to open a frame, then the other textbuttons wont open the other frames.

2 Likes

try something like this

for i,v in pairs(frame:GetDescendants()) -- change "frame" to frame you want to loop through
   if v:IsA("TextButton") then
      v.Active = false
   end
end
for _,button in pairs(script.Parent:GetChildren()) do
	if button:IsA("TextButton") then
		button.MouseButton1Click:Connect(function()
			for _,frame in pairs(script.Parent:GetChildren()) do
				script.Parent:FindFirstChild(button.Text).Visible = true
				if frame:IsA("Frame") and frame.Name ~= button.Name then
					frame.Visible = false
				end
			end
		end)
	end
end

This will make sure you could open 1 frame ,and close the others :
robloxapp-20220326-2212156.wmv (310.1 KB)

1 Like

Of course you could change/edit it accordingly

Another example :

HELP.MouseButton1Click:Connect(function()
	HELP.Hframe.Visible = not HELP.Hframe.Visible
	for _,button in pairs(script.Parent:GetChildren()) do
		if button:IsA("ImageButton") then
			if button:FindFirstChildWhichIsA("Frame") then
				if button:FindFirstChildWhichIsA("Frame").Visible == true and button.Name ~= HELP.Name  then
					button:FindFirstChildWhichIsA("Frame").Visible = false
				end
			end
		end
	end
end)

1 Like

Would i put this inside a button or inside of the frame being opened?

Make a ScreenGui, and insert buttons and frames into it

Make sure to name those frames as same as your buttons’ Text (you could change that in the script if you want)

1 Like
script.Parent.MouseButton1Click:Connect(function() 
	script.Parent.Parent.FRAMENAMEHERE.Visible = true 
	script.Parent.Visible = false 
	end)

This is an easier way of doing what you said, turning off the button after clicking, then opening the frame.

1 Like

Yeah, I just showed him a few examples that I did in the past

image
this is currently how i have it.

Well I want all the textbuttons to not click when any frame is open.

You could make your buttons invisible while on a certain frame.

Oh yeah thats true, how would I do that?

1 Like

Duplicate line 3 of the script, but do script.Parent.Parent.Parent.BUTTONNAMEHERE.VIsible = false

1 Like

Make sure to put the exact location of the button, just keep adding this until it applies to all buttons.

But, how would it re-appear after the frame is closed?

Imagine this is a close button script:

script.Parent.MouseButton1Click:Connect(function() 
script.Parent.Parent.Parent.Visible = false 
Script.Parent.Parent.Parent.Parent.OPENBUTTONNAMEHERE.Visible = true  
end)

Oh I see… I’m going to try that right now.

Yea, its very simple scripting. Making it un-visible also makes a button unclickable.

Yeah, so for example if I use a blur image for the background and remove all the ui from around the frame like the textbuttons, would it be the same thing? I just make the blur image visible?

1 Like