Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can someone help? [ANSWERED]

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?

1 answer

✓ Accepted answer

Your problem is simple, on line 3 you indexed the 'MainShop' as 'mainShop.' Simply capitalize your M on line 3.

This discussion is preserved as it was. New answers, comments, and votes are closed.