Skip to main content

CoreGuiEnabler

Key based CoreGuiEnabler, singleton Use this class to load/unload CoreGuis / other GUIs, by disabling based upon keys Keys are additive, so if you have more than 1 disabled, it's ok.


local CoreGuiEnabler = require("CoreGuiEnabler")

-- Disable the backpack for 5 seconds
local cleanup = CoreGuiEnabler:Disable(newproxy(), Enum.CoreGuiType.Backpack)
task.delay(5, cleanup)

Functions

IsEnabled

CoreGuiEnabler:IsEnabled(coreGuiStatestring | CoreGuiType) → boolean

Gets the current state

ObserveIsEnabled

CoreGuiEnabler:ObserveIsEnabled(coreGuiStatestring | CoreGuiType) → Observable<boolean>

Observes the state whenever it changed

AddState

CoreGuiEnabler:AddState(
coreGuiStatestring | CoreGuiType,
onChangeCallback(isEnabledboolean)
) → ()

Adds a state that can be disabled or enabled.

Disable

CoreGuiEnabler:Disable(
keyany,
coreGuiStatestring | CoreGuiType
) → function--

Callback function to re-enable the state

Disables a CoreGuiState

Enable

CoreGuiEnabler:Enable(
keyany,
coreGuiStatestring | CoreGuiType
) → ()

Enables a state for a given key

Show raw api
{
    "functions": [
        {
            "name": "IsEnabled",
            "desc": "Gets the current state",
            "params": [
                {
                    "name": "coreGuiState",
                    "desc": "",
                    "lua_type": "string | CoreGuiType"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 114,
                "path": "src/coreguienabler/src/Client/CoreGuiEnabler.lua"
            }
        },
        {
            "name": "ObserveIsEnabled",
            "desc": "Observes the state whenever it changed",
            "params": [
                {
                    "name": "coreGuiState",
                    "desc": "",
                    "lua_type": "string | CoreGuiType"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 128,
                "path": "src/coreguienabler/src/Client/CoreGuiEnabler.lua"
            }
        },
        {
            "name": "AddState",
            "desc": "Adds a state that can be disabled or enabled.",
            "params": [
                {
                    "name": "coreGuiState",
                    "desc": "",
                    "lua_type": "string | CoreGuiType"
                },
                {
                    "name": "onChangeCallback",
                    "desc": "",
                    "lua_type": "(isEnabled: boolean)"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 147,
                "path": "src/coreguienabler/src/Client/CoreGuiEnabler.lua"
            }
        },
        {
            "name": "Disable",
            "desc": "Disables a CoreGuiState",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "any"
                },
                {
                    "name": "coreGuiState",
                    "desc": "",
                    "lua_type": "string | CoreGuiType"
                }
            ],
            "returns": [
                {
                    "desc": "Callback function to re-enable the state",
                    "lua_type": "function"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 182,
                "path": "src/coreguienabler/src/Client/CoreGuiEnabler.lua"
            }
        },
        {
            "name": "Enable",
            "desc": "Enables a state for a given key",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "any"
                },
                {
                    "name": "coreGuiState",
                    "desc": "",
                    "lua_type": "string | CoreGuiType"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 213,
                "path": "src/coreguienabler/src/Client/CoreGuiEnabler.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "CoreGuiEnabler",
    "desc": "Key based CoreGuiEnabler, singleton\nUse this class to load/unload CoreGuis / other GUIs, by disabling based upon keys\nKeys are additive, so if you have more than 1 disabled, it's ok.\n\n```lua\n\nlocal CoreGuiEnabler = require(\"CoreGuiEnabler\")\n\n-- Disable the backpack for 5 seconds\nlocal cleanup = CoreGuiEnabler:Disable(newproxy(), Enum.CoreGuiType.Backpack)\ntask.delay(5, cleanup)\n```",
    "source": {
        "line": 17,
        "path": "src/coreguienabler/src/Client/CoreGuiEnabler.lua"
    }
}