Add a ScreenGui inside the StarterGui and add a TextButton or ImageButton. Add a LocalScript and script this:
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible
end)
Add a ScreenGui inside the StarterGui and add a TextButton or ImageButton. Add a LocalScript and script this:
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible
end)
There have code.
script.Parent.MouseButton1Click:connect(function() -- Fire when they click.
if script.Parent.Parent.Frame.Visible == true then -- Check if its visible.
script.Parent.Parent.Frame.Visible = false
else
script.Parent.Parent.Frame.Visible = true
end
end)
Next time try to be more clear with your questions.
Hello! I hope this code helps. We want to consolidate this code into one script to make it look neater, otherwise it's pretty simple (pm if you want that code).
local button = script.Parent; -- change to your button (if it's not the parent)
local frame = script.Parent.Frame; -- change to the frame you want to open/close
button.MouseButton1Down:connect(function() -- fire the code when button is clicked
if frame.Visible == true then
frame.Visible == false
-- logic here
else
frame.Visible == true
-- logic here
end
end)
Hope this helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
I do not know what it is you're asking. Close and Open what???
Should be using Connect. Also stop copying me.
you dont have to, connect and Connect do the exact same thing. Plus connect will never be deprecated.
Instead of Visible = not, do: Visible = false