You might refer to something like this, maybe
function OnClick()
shop = script.Parent.Parent
shop.Visible = not shop.Visible
end
end
script.Parent.MouseButton1Down:connect(onClick)
First thing. Where are you trying to Parent the "shop" variable? If it's like you wrote above, then you're refering to a ScreenGui, right? Unless the button is under a Frame object.
Second. Why are you trying to make the Gui invisible by changing its value to "not shop.Visible"? It should be shop.Visible = false
Third. Why are there 2 "ends"? You only created 1 block (the function), so there's no need for a second end.
It should look like this
function onClick()
Shop = script.Parent.Parent
Shop.Visible = false
Shop2 = game.StarterGui.Shop2
Shop2.Visible = true
end
script.Parent.MouseButton1Down:connect(onClick)
2 comments
Please add the code into a LUA Code Block...
Do not duplicate your question.