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

Why Aren't I Able To Open My GUI?

Asked by 8 years ago

I've made it a keypressed open/close and it only seems to open in "edit" mode and not in "play" mode.

a = script.Parent.Parent.Shop

game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(Key)
    if Key == "m" then
        a.Visible = not a.Visible
    end
end)

I looked in server console and I saw: Players.cryptomaniacRBLX.PlayerGui.ScreenGui.Shop.Scriptclose:3: attempt to index field 'LocalPlayer'

I have no idea what it means

1 answer

Log in to vote
0
Answered by
TopDev 0
8 years ago
local plr = game.Players.LocalPlayer
plr.PlayerGui:WaitForChild("ScreenGui")
a = plr.PlayerGui.ScreenGui:WaitForChild("Shop")

plr:GetMouse().KeyDown:connect(function(Key)
    if Key == "m" then
        a.Visible = not a.Visible
    end
end)

Ad

Answer this question