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

My GUI won't open, but it will close. How do I fix this? [Solved]

Gyazos: https://gyazo.com/440649bfcc4dd0dd32a745084e26825d https://gyazo.com/244ccb990982a14d38d3207bdebe0f7e

Code:

local frame = script.Parent.Parent.Frame
local news = script.Parent.Parent
local open = script.Parent

open.MouseButton1Click:Connect(function()
	frame.Visible = frame.Visible
	print('gui has been opened')
end)

so like i can use the close button but i can't use open button?!?!?!?!?! WHAT?!?!?!?

2 comments

0

With how you set up your code, it's quite simple: you're trying to have it so you don't have to go through all that extra work; the simple answer is you forgot the "not " operator. :P

1 answer

Just use one button and change the text when its opened or closed like this:

local frame = script.Parent.Parent.Frame
local news = script.Parent.Parent
local open = script.Parent
local Opened = false

open.MouseButton1Click:Connect(function()
   if Opened == false then
    Opened = true
    frame.Visible = true
    open.Text = "Close" --Remove this if you want
 else
     Opened = false
    frame.Visible = false
    open.Text = "Open" --Remove this if you want too
   end
end)

this should work with one button, upvote if it helped!

1 comment

0

All of that isn't required; the solution is in the original code.

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