Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to Open / Close Gui Without button being parent of Gui's Frame?

So i want a better way of opening a closing the GUI, basically like the button you open it with is in a diffrent screen gui, the button goes transparent whenever i pair it with the frame in the gui, how would i make it so i can open / close the gui without the button being in the gui's frame? (sorry if this is confusing,i dont know any other way to phrase it)

function leftClick(mouse)
	 script.Parent.Parent.HelpGui.Visible = true
end
script.Parent.MouseButton1Click:connect(leftClick)

function rightClick(mouse)
	script.Parent.Parent.HelpGui.Visible = false
end
script.Parent.MouseButton2Click:connect(rightClick)

3 comments

0

Do script.Parent.Parent.... like normal

0

where would i put the button or script thjough

0

The button cannot be a descendant of script.Parent.Parent.HelpGui, put it in another Gui and reference it like Nguyen said: script.Parent.Parent.Parent.HelpGuiButton etc.

1 answer

This is simple to solve first you add a local script in the Button and type this




local frame = script.Parent.Parent.Frame -- change this to the name of your frame
local open = false

script.Parent.MouseButton1Click:Connect(function()--basically this means if Frame is not showing and you click it then it will show but if you don't click it then it won't show
	if frame.visible == true then
		frame.visible = false
	else
		frame.Visible = true
	end
end)



Don't put the button in the Frame Gui. Now the Frame is not the parent of the button instead they're two object separated in the ScreenGui

1 comment

0

This is how you do a button to show a frame without the Frame being the parent of the button

This discussion is preserved as it was. New answers, comments, and votes are closed.