Still have questions? Join our Discord server and get real time help.
-3

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

3
drahsid5 250
6 years ago

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)

0
it doesnt work FPSStudioDidi 1 — 6y
0
That's because you didn't change the locations of the frames and text button. drahsid5 250 — 6y
0
oh o thanks FPSStudioDidi 1 — 6y
0
If it worked then hit the button that says that I'd answered your question. drahsid5 250 — 6y