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

How Does A Text Button in Gui Is clicked And Another Gui Pops Up?

Ive Been trying to figure this out for days Please Help!

1 answer

✓ Accepted answer

Your title's grammar, amazing. I'm assuming you'd like to know how to make a GUI pop up when you click a text/image button. So, That's what I'll tell you. Sense we'll need the local player's mosue, we'll start off with this:

repeat wait() until game.Players.LocalPlayer

Why that? So the local player is there before anything else can happen. (Preventing errors) Next we get the mouse;

local mouse = game.Players.LocalPlayer:GetMouse()

Now, lets be neat, and tell it the directory of our frames and buttons.

local FirstFrame = script.Parent.Parent --Or wherever your first frame is, the text button is likely inside of it, so this is what you'd usally put
local PopUpFrame = script.Parent.Parent.Parent.PopUp --Once again, change this to wherever your frame is located.
local Button = script.Parent --The script will most likely be in the button

Next we add the OnClick function, and the popup.

function onClick()
if PopUpFrame.Visible == true then
	PopUpFrame.Visible = false

elseif PopUpFrame.Visible == false then
PopUpFrame.Visible = true
end	
end

Button.MouseButton1Click:connect(onClick)

and then your done. The full script would look something like this:

repeat wait() until game.Players.LocalPlayer
local mouse = game.Players.LocalPlayer:GetMouse()

local FirstFrame = script.Parent.Parent --Or wherever your first frame is, the text button is likely inside of it, so this is what you'd usally put
local PopUpFrame = script.Parent.Parent.Parent.PopUp --Once again, change this to wherever your frame is located.
local Button = script.Parent --The script will most likely be in the button

function onClick()
if PopUpFrame.Visible == true then
	PopUpFrame.Visible = false

elseif PopUpFrame.Visible == false then
PopUpFrame.Visible = true
end	
end

Button.MouseButton1Click:connect(onClick)

4 comments

0

it doesnt work

0

That's because you didn't change the locations of the frames and text button.

0

oh o thanks

0

If it worked then hit the button that says that I'd answered your question.

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