Okay so I am trying make a open and gui script. This is what I have and it only works in studio but not in the actual game, I don't know what I could've did wrong :/. But can I also use this as Image Button instead?
local Button = script.Parent Frame = script.Parent.Parent.Parent.BuyCash function onClick() if Frame.Visible == false then Frame.Visible = true elseif Frame.Visible == true then Frame.Visible = false end end Button.MouseButton1Click:connect(onClick)
It seems to work fine. Try removing the "elseif" like the other reply said. However, for simplicity, I've edited the code a bit so that it looks cleaner & easier to manage:
local Button = script.Parent Frame = script.Parent.Parent.Parent.BuyCash function onClick() Frame.Visible = not Frame.Visible end Button.MouseButton1Click:connect(onClick)
Probably the elseif is messing things up as normal.
Try this:
local Button = script.Parent Frame = script.Parent.Parent.Parent.BuyCash function onClick() if Frame.Visible == false then Frame.Visible = true else Frame.Visible = false end end Button.MouseButton1Click:connect(onClick)