So I have a Close/Open, and I'm developing a GUI that when click closes the frame its in and opens another frame and the script won't work exactly went wrong. (I know I'm dumb)
---Information--- The button is in frame 1 and has a local script in it for the script.
---Script---
script.Parent.MouseButton1Click:Connect(function() if script.ScreenGui1.Frame1.Visible == true then script.ScreenGui1.Frame1.Visible = false wait(0) if script.ScreenGui1.Frame2.Visble == false then script.ScreenGui1.Frame2.Visible = true end end end)
i found a solution:
put the button in the gui and put this script in the button:
frame1 = script.Parent.Parent.Frame1 frame2 = script.Parent.Parent.Frame2 script.Parent.MouseButton1Click:Connect(function() frame1.Visible = not frame1.Visible end) script.Parent.MouseButton1Click:Connect(function() frame2.Visible = not frame2.Visible end)
Alright, you forgot an elseif ;-;
local btn = script.Parent btn.MouseButton1Click:connect(function() if script.ScreenGui1.Frame1.Visible == true then script,ScreenGui1.Frame1.Visible = false elseif script.ScreenGui1.Frame1.Visible == false then script.ScreenGui1.Frame1.Visible = true end end end)
its easy to see the problem