Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Aeike 9
7 years ago
Edited by OldPalHappy 7 years ago

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?!?!?!?

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 TheeDeathCaster 2368 — 7y

1 answer

Log in to vote
-3
Answered by 7 years ago

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!

0
All of that isn't required; the solution is in the original code. TheeDeathCaster 2368 — 7y
Ad

Answer this question