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

How do I make a GUI do 2 things?

Asked by
Qxest 25
10 years ago

I want to make a GUI open a Help GUI., and if it is clicked again to close it. I don't know how to do the second part.

1 answer

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
10 years ago

This piece of code stores a boolean value of whether the Help GUI is open or not. When the button is clicked, it checks whether it is open or closed then changes the visibility accordingly:

local open = false
local gui = TextButton -- Change this to the location of your open/close button
local help = Frame -- Change this to the location of your help menu

gui.MouseButton1Click:connect(function()
    if open == true then
        help.Visible = false
        open = false
    elseif open == false then
        help.Visible = true
        open = true
    end
end)
Ad

Answer this question