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

How do i make a button make a frame pop up and dissapear?

How do i make a button make a frame pop up and dissapear but it can also have an x button that makes the frame go away and the button visible

local frame = script.Parent.Parent.Frame

script.Parent.MouseButton1Click:connect(function()
 if frame.Visible == false then
  frame.Visible = true
 else
  frame.Visible = false   
 end
end)

https://web.roblox.com/games/5486860140/Tower-Adventures?refPageId=5a3e4864-1159-4bfe-850d-80e6f4876520 Example is from tower battles play button. Btw im new at coding so posting the full script would help

1 answer

✓ Accepted answer
local frame = script.Parent.Parent.Frame

script.Parent.MouseButton1Down:Connect(function()
if frame.Visible == false then
frame.Visible = true
script.Parent.Visible = false
else
frame.Visible = false
script.Parent.Visible = true
end
end)

so your error was 'botton' which is spelled 'button' and I changed it to mousebutton1down because that works for mobile and pc! accept my answer if it worked!

3 comments

0

but how do i make the button you press dissapear?

0

oh simple

0

There's an easier way which is frame.Visible = not frame.Visible instead of the if else statements

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