I am trying to make a funcionaly textbutton that when got clicked display a specific frame and in that frame the button is not visible, but the script i use doesn’t work.
Script:
local Frame = script.Parent.MainMenu
local Button = Frame.TextButton
Button.MouseButton1Click:Connect(function()
Button.Visible = not Button.Visible
end)
I’d recommend reading the error you get in the Output. Take a look at your first line. What’s the Parent of script and does it have a child called MainMenu?
What is happening is that you are making the button itself invisible:
Here is my try on fix of the code:
local Frame = script.Parent.MainMenu
local Button = Frame.TextButton
Button.MouseButton1Click:Connect(function()
Button.Visible = not Button.Visible
end)
But this also would be bad, since the button is a child of Frame, meaning that if you set the MainMenu/Frame’s visibility to false, the button would also become invisible, consider making some changes.