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

How do I create a working popup menu button?

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?

4 comments

1

use the not operator instead of using if statements

0

also use local variables

0

he is using local variables

0

the function isnt local

1 answer

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)

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