local function click(player) player.PlayerGui.Shop.Frame.Visible = true end script.Parent.ClickDetector.MouseClick:connect(click)
You don't use a click detector like that lol. Put this code in a LocalScript, in a ScreenGui in StarterGui, but not inside the Frame. Remember to put the LocalScript inside of a TextButton.
script.Parent.MouseButton1Click:Connect(function() -- TextButton's have their own mouse click event. script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible end)
Review: In line 1, we set up the event. Line 2, we change the Visible state of the frame to its opposite, "not true" is false and vice versa. Follow the first steps. Where to put it.
If you're using FE, this won't work because scripts can't run or change the player's playergui, only localscripts can. Even if FE is off, this is very bad practice because you only need a LocalScript, since the PlayerGui is on the client, not for all the clients. In a nutshell, only use localscripts if you want to make changes on client only, and scripts to do things that show up on all clients. But if you wanted to change it for all clients, well, you would need a remoteevent since as I said earlier, scripts can't access playergui with FE on.