So I have an open and close script for one button, but it seems to not work what did I do wrong, and don't say why don't you put a close button on the Frame? Its because the frame does not have enough room.
script.Parent.MouseButton1Click:Connect(function() game.Players.LocalPlayer.PlayerGui.Catalog.Morphs.Visible == true then game.Players.LocalPlayer.PlayerGUI.Catalog.Morphs.Visible = false elseif game.Player.LocalPlayer.PlayerGUI.Catalog.Morphs.Visible == false then game.Player.LocalPlayer.PlayerGUI.Catalog.Morphs.Visible = true end end)
well, you could write the code in fewer lines. liek this:
local morphs = game.Players.LocalPlayer.PlayerGui.Catalog.Morphs script.Parent.MouseButton1Click:Connect(function() morphs.Visible = not Visible end)
btw, there must be some other parts in ur code thats making it not work..
one of which could be that an error is taking place, because u forgot the if
keyword
or game.Players.LocalPlayer.PlayerGui.Catalog.Morphs is not a true directory, and etc
Well you did one simple mistake. Here's the corrected form:
script.Parent.MouseButton1Click:Connect(function() if game.Players.LocalPlayer.PlayerGui.Catalog.Morphs.Visible == true then game.Players.LocalPlayer.PlayerGUI.Catalog.Morphs.Visible = false elseif game.Player.LocalPlayer.PlayerGUI.Catalog.Morphs.Visible == false then game.Player.LocalPlayer.PlayerGUI.Catalog.Morphs.Visible = true end end)
Basically you just missed putting an "if" before the first statement. Here's a shortened version of your code if you'd like to use that:
local Catalog = game.Players.LocalPlayer.PlayerGui.Catalog script.Parent.MouseButton1Click:Connect(function() if Catalog.Morphs.Visible == true then Catalog.Morphs.Visible = false elseif MorphCLog.Visible == false then Catalog.Morphs.Visible = true end end)
In the shortened version, a variable was added for your morph catalog and when you use it, you can use the variable instead of the long version.
Hope this fixed your problem. :)
Edit: Sorry if it might not be indented perfectly. Just re-indent (recommended) them correctly or un-indent them.