I made this local script to open the GUI
script.Parent.MouseButton1Click:connect(function() game.StarterGui.Shop.MainFrame.Visible = true end)
I made this local script to close the GUI
script.Parent.MouseButton1Click:connect(function() game.StarterGui.Shop.MainFrame.Visible = false end)
Are there any errors in them that make them not work?
Your issue is that you are editing a GUI in the StarterGui. That is not the GUI in use by the current player. Here is a better alternative to your code.
Please note I have used a recursive FindFirstChild because I do not know the structure of your GUI tree.
To open and close the GUI (same script does both)
local player = game.Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") script.Parent.MouseButton1Click:connect(function() local shop = playerGui:FindFirstChild("Shop", true) shop.MainFrame.Visible = not shop.MainFrame.Visible end)
You are looking inside the StarterGui, which is just where all the guis are stored. When a player joins the game, all guis in StarterGui are replicated into the player's individual PlayerGui, so that they are unique to each player. So to fix this, you can try replacing the StarterGui with the local player's PlayerGui:
script.Parent.MouseButton1Click:Connect(function() game.Players.LocalPlayer.PlayerGui.Shop.MainFrame.Visible = true end)
script.Parent.MouseButton1Click:Connect(function() game.Players.LocalPlayer.PlayerGui.Shop.MainFrame.Visible = false end)