Skip to main content

ClientStateManager

This item only works when running on the client. Client

Manages the local replication and storage of game states received from the server. Utilizes the Networker module to listen for state updates and maintains a local cache.

Functions

init

ClientStateManager.init() → ()

Initializes the ClientStateManager by connecting to the ReplicateClientStates remote. It automatically handles JSON decoding for string-based state values.

checkState

ClientStateManager.checkState(
stateNamestring--

The name of the state to check.

) → any--

The current value of the state, or nil if not set.

Retrieves the value of a specific state by its name.

getStates

ClientStateManager.getStates() → {[string]any}--

The dictionary of all states.

Returns the entire table of currently tracked states.

Show raw api
{
    "functions": [
        {
            "name": "init",
            "desc": "Initializes the ClientStateManager by connecting to the `ReplicateClientStates` remote.\nIt automatically handles JSON decoding for string-based state values.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 28,
                "path": "global/ReplicatedStorage/Scripts/Client/Player/ClientStateManager/init.luau"
            }
        },
        {
            "name": "checkState",
            "desc": "Retrieves the value of a specific state by its name.",
            "params": [
                {
                    "name": "stateName",
                    "desc": "The name of the state to check.",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "The current value of the state, or nil if not set.",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 49,
                "path": "global/ReplicatedStorage/Scripts/Client/Player/ClientStateManager/init.luau"
            }
        },
        {
            "name": "getStates",
            "desc": "Returns the entire table of currently tracked states.",
            "params": [],
            "returns": [
                {
                    "desc": "The dictionary of all states.",
                    "lua_type": "{[string]: any}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 58,
                "path": "global/ReplicatedStorage/Scripts/Client/Player/ClientStateManager/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ClientStateManager",
    "desc": "Manages the local replication and storage of game states received from the server.\nUtilizes the Networker module to listen for state updates and maintains a local cache.",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 9,
        "path": "global/ReplicatedStorage/Scripts/Client/Player/ClientStateManager/init.luau"
    }
}