Skip to main content

Network

Manages client-server communication via RemoteEvents.

Functions​

new​

Network.new() → Network

Creates a new Network instance and sets up RemoteEvents.

create​

Network:create() → RemoteConfig

Creates RemoteEvents if they don't exist and returns RemoteConfig.

sendStateUpdate​

Network:sendStateUpdate(
playerId: string,--

The UserId as a string

state: PlayerSkillState--

The updated state

) → ()

Sends state update to a specific player.

connectUnlockRequest​

Network:connectUnlockRequest(
callback: function--

Callback(player, nodeId)

) → ()

Connects to unlock requests from clients.

connectUpgradeRequest​

Network:connectUpgradeRequest(
callback: function--

Callback(player, nodeId)

) → ()

Connects to upgrade requests from clients.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Creates a new Network instance and sets up RemoteEvents.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Network"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 27,
                "path": "src/Network.luau"
            }
        },
        {
            "name": "create",
            "desc": "Creates RemoteEvents if they don't exist and returns RemoteConfig.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RemoteConfig"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 35,
                "path": "src/Network.luau"
            }
        },
        {
            "name": "sendStateUpdate",
            "desc": "Sends state update to a specific player.",
            "params": [
                {
                    "name": "playerId",
                    "desc": "The UserId as a string",
                    "lua_type": "string"
                },
                {
                    "name": "state",
                    "desc": "The updated state",
                    "lua_type": "PlayerSkillState"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 70,
                "path": "src/Network.luau"
            }
        },
        {
            "name": "connectUnlockRequest",
            "desc": "Connects to unlock requests from clients.",
            "params": [
                {
                    "name": "callback",
                    "desc": "Callback(player, nodeId)",
                    "lua_type": "function"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 83,
                "path": "src/Network.luau"
            }
        },
        {
            "name": "connectUpgradeRequest",
            "desc": "Connects to upgrade requests from clients.",
            "params": [
                {
                    "name": "callback",
                    "desc": "Callback(player, nodeId)",
                    "lua_type": "function"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 89,
                "path": "src/Network.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Network",
    "desc": "Manages client-server communication via RemoteEvents.",
    "source": {
        "line": 11,
        "path": "src/Network.luau"
    }
}