I'm having trouble with a script. Whenever I click my GUI, it doesn't turn visible.
I used this script:
script.Parent.MouseButton1Click:connect(function() MainShop = script.Parent.Parent.MainShop if mainShop.Visible ~= false then MainShop.Visible = true script.Parent.Text = "Close" else MainShop.Visible = false script.Parent.Text = "Open" end end)
In output it says: Players.Player1.PlayerGui.Shop.Button.Script:3: attempt to index global 'mainShop' (a nil value)
Any help?
Your problem is simple, on line 3 you indexed the 'MainShop' as 'mainShop.' Simply capitalize your M on line 3.