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 on a surface GUI open a new Frame?

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?

1 comment

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

1 answer

✓ Accepted answer

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

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