- What do you want to achieve?
I want to add this new feature to the project I’m working on where the player can leave the main menu GUI to play the game without a GUI covering the screen.
- What is the issue?
When I close the GUI for the first time and open it up again it works fine, then I close it again and my return button vanishes forever even though it worked the first time.
before re-opening menu GUI
after re-opening menu GUI and then closing again to check if the button is still there
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve spent more than an hour debugging and it hasn’t been fixed. I checked solutions and didn’t find any that matched my situation where the “GUI opener button disappears”
Here’s the code for my button:
local smGUI = script.Parent.Parent.Parent
local smGUIFrame = smGUI:WaitForChild("smScreen")
local rtpButton = script.Parent
-- Eventually fix bug where you can only leave the menu once or the ui will be gone forever
script.Parent.MouseButton1Click:Connect(function()
smGUIFrame.Visible = true
rtpButton.Visible = false
end)
Here’s my hierarchy in case that’s what is causing the issue with this script:
I can’t figure out what’s wrong with my script as it’s a generic script I’ve used for every other button in my game and it’s been working out great so far until now.
Please help me find what’s wrong with my code and either explain how I can fix it or please show me the updated code that will solve this bug.
I would be very happy to have your help! Thank you!