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

Trying to read CoreGui returns error?

Asked by 2 years ago

I am attempting to detect when the player's menu is active to hide a GUI.

I made a script (Local Script) to get the Roblox menu (RobloxGui) via CoreGui and to detect whether it is visible or not:

local CoreGui = game:GetService("CoreGui")
local RobloxGui = CoreGui:WaitForChild("RobloxGui")
local SettingsShield = RobloxGui:WaitForChild("SettingsShield"):WaitForChild("SettingsShield")

SettingsShield:GetPropertyChangedSignal("Visible"):Connect(function()

    if SettingsShield.Visible == true then

        script.Parent.Enabled = false

    else

        script.Parent.Enabled = true

    end

end)

However, upon attempting to access this data, an error message is displayed on line 2:

"The current identity (2) cannot Class security check (lacking permission 1)"

I am already aware that Roblox has restrictions to prevent undesired use of certain assets. I was wondering if there is a way to properly detect whether the Roblox menu is active or not. Maybe using CoreGui:GetCoreGuiEnabled? Thanks!

Answer this question