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

How do I make a toggle visiblitiy gui button?

Asked by
Asirix 15
10 years ago

So far I have this. It's really just an infinite loop. XD I can make separate open and close gui buttons using visibility, but cannot make them in one.

Here's what I have:

script.parent.MouseButton1Click:connect(function(Open)
    if game.StarterGui.ExploreID.ProfileShade.Visible==false then
     game.StarterGui.ExploreID.ProfileShade.Visible=true
    if game.StarterGui.ExploreID.ProfileShade.Visible==true then
        game.StarterGui.ExploreID.ProfileShade.Visible=false
    end
    end
end)

I have no clue where to go from here, I'm learning through trial and error. XD

0
use elseif on line 4 instead of if... FearMeIAmLag 1161 — 10y
0
THANKYOU Asirix 15 — 10y
0
IT STILL DOESN'T WORK :( Asirix 15 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

If you are trying to make a button that makes a GUI visible if you click it, then makes it invisible if you click it again, use this:

local Gui = script.Parent.ProfileShade --This is assuming that this button is in ProfileShade. Make sure you do not define the one is StarterGui. That is the template you start out with.
script.Parent.MouseButton1Click:connect(function(Open) --Make sure to capitalize Parent
    if Gui.Visible==false then      
        Gui.Visible=true
        else Gui.Visble = false --If it is not false, it has to be true.
    end
end)

Hopefully this helps!

Ad

Answer this question