Hello, I am needing help with this Open/Close button for my GUI. This is my current script:
script.Parent.MouseButton1Click:connect(function() if script.Parent.Parent.Frame.Visible == false then script.Parent.Parent.Frame.Visible = true script.Parent.Text = "Close" if script.Parent.Parent.Frame.Visible == true then script.Parent.Parent.Frame.Visible = false script.Parent.Text = "Open" end end end)
It isn't working when I go in test mode and click on it.
Can you help me?
Script
. Before Experimental Mode
was completely removed, Script
s were able to run in PlayerGui
. But since Experimental Mode
was removed, this is no longer the case. FilteringEnabled
has been forced, but FE compatibility is not required for your script. The change really is to make it a LocalScript
. It can also be made much shorter and cleaner.local frame = script.Parent.Parent.Frame script.Parent.MouseButton1Click:Connect(function() -- connect is deprecated use Connect frame.Visible = not frame.Visible -- easy way to toggle a boolean script.Parent.Text = frame.Visible and "Close" or "Open" -- here, if the frame is not visible, the text will show "Open". If it is visible, show "Close" end)