I have made a script where when you click a button, it toggles the shop GUI on or off, here is the script:
player = game.Players.LocalPlayer
shop = player.PlayerGui:FindFirstChild('ShopGUI').MainFrame
script.Parent.MouseButton1Click:connect(function()
shop.Visible = not shop.Visible
end)
Any help would be appreciated, thanks! There is also an error when I load up the game on roblox studio, it says: 22:18:54.626 - Players.Player.PlayerGui.Buttons.Frame.TextButton.LocalScript:2: attempt to index a nil value

2 comments
The script is a localscript, correct?
Yeah, can you put it all into one script?