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

How do I make a button on a surface GUI open a new Frame?

Asked by 7 years ago

I'm stuck trying to make this happen. I'm making a virtual PC in ROBLOX, but I'm not sure how to make a TextButton so when it is clicked, open up a new frame and close the older frame. Anyone have an idea?

0
One way you could try, is to have the GUI in Startergui, and setting the Adornee rather than scripting it straight onto the part: http://wiki.roblox.com/index.php?title=API:Class/SurfaceGui/Adornee turtle2004 167 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

If you are asking for a simple Open and Close function for a gui here it is

local openFrame = script.Parent.YourOpenFrame -- frame wanted to  open
local closeFrame = script.Parent.YourCloseFrame --  frame wanted to close
local db = true  -- set debounce

script.Parent.MouseButton1Click:Connect(function()
    if not db then -- if debounce is not true 
    return 
    end
    db = false
    closeFrame.Visible = false
    openFrame.Visible = true
    wait(1)
    db = true

end)

This opens the wanted frame and closes the other frame

Ad

Answer this question