Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Can someone help? [ANSWERED]

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

Log in to vote
0
Answered by 10 years ago

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

Ad

Answer this question