When TextButton clicked, Frame will become visibile

I have been looking for this for long but I can’t find anything really. What’s meant to happen is simple, when Game1 TextButton gets clicked, the Frame01 becomes visible.
Screenshot_359

I really appreciate if anyone helps. Would be great if it’s possible to make it invisible after clicking it for the second time.

Put this local script into the TextButton:

script.Parent.MouseButton1Down:Connect(function()
script.Parent.Parent.Frame01.Visible = true
end)

Now there are more ways:
1: if you have an exit button inside the Frame01

script.Parent.MouseButton1Down:Connect(function()
script.Parent.Visible = false
end)

2: if you don’t have an exit button inside your Frame01

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

I think I made you confused a bit :confused:

1 Like

I’d recommend using MouseButton1Down, “MouseButton1Click” can only detect PC input

Just add 3 LocalScripts parented inside each TextLabel & reference them as this for more easier use

local TextButton = script.Parent

TextButton.MouseButton1Down:Connect(function()
    --Make Frame1 visible here
end)
2 Likes
script.Parent.Visible = not script.Parent.Visible
1 Like

The local script you put into the TextButton indeed works, after clicking the Frame appears, but I don’t understand the rest :woozy_face:
I wanna make it so after the Frame appears,(clicked the button) clicking the TextButton again makes it disappear,(i don’t want exit button inside the frame) I’m not sure where to put the last script (long one) at all

Yes, the last code will do what you want. Sorry for confusing you.

1 Like

I made it the way I understand. I am not a programmer.

1 Like

I did that and got following error:
Players.MATIEO33.PlayerGui.ScreenGui.TextButton.Game1.LocalScript:8: Expected identifier when parsing expression, got ‘)’

I asked a person on a discord server for help. Thanks to everyone else tho, you guys helped me too.
For anyone wondering what the code worked for me, it is this:

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