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

How do I create a working popup menu button?

Asked by 5 years ago

So I'm trying to make a popup menu button but this script doesn't seem to work!\ I made sure that everything was in the right place as well.

local Button = script.Parent
local Frame = script.Parent.Parent.Frame
Frame.Visible = false
function onClick()
    if Frame.Visible == false then 
        Frame.Visible = true
    elseif Frame.Visible == true then 
        Frame.Visible = false
    end
end

Button.MouseButton1Click:Connect(onClick)

What's the issues with this script?

1
use the not operator instead of using if statements User#23365 30 — 5y
0
also use local variables theking48989987 2147 — 5y
0
he is using local variables User#23365 30 — 5y
0
the function isnt local theking48989987 2147 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I have the Button, Frame and Script all under the ScreenGui. Placed in Starter GUI. Might need to change the variables accordingly

local Gui = script.Parent
local Frame = Gui.Frame
local Button = Gui.Button

local function onClick()
    if Frame.Visible == true then
        Frame.Visible = false
    else
        Frame.Visible = true
    end
end

Button.MouseButton1Click:Connect(onClick)
Ad

Answer this question