Skip to main content

NetEvent

Network Event

Allows for client-server communication.

Base class that all the Roket networking functionality is based on.

Functions

Load

NetEvent.Load(optionsOrIdLoadOptions | string) → NetEvent

Types

interface LoadOptions {
Idstring
Unreliableboolean
Middlewares{
FireMiddlewares,
ListenMiddlewares
}
}

Load a Roket network event

Read more on the docs.

Fire

NetEvent:Fire(
anyOrServerPlayerPlayer?,
...any
) → ()

Fire a network event

Listen

NetEvent:Listen(rawListener(
playerPlayer?,
...any
) → ()) → ()

Listen to a network event

Show raw api
{
    "functions": [
        {
            "name": "Load",
            "desc": "Load a Roket network event\n\nRead more on the [docs](/docs/core_concepts/network_event).",
            "params": [
                {
                    "name": "optionsOrId",
                    "desc": "",
                    "lua_type": "LoadOptions | string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "NetEvent"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 44,
                "path": "src/roket/module/NetEvent.luau"
            }
        },
        {
            "name": "Fire",
            "desc": "Fire a network event",
            "params": [
                {
                    "name": "anyOrServerPlayer",
                    "desc": "",
                    "lua_type": "Player?"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 70,
                "path": "src/roket/module/NetEvent.luau"
            }
        },
        {
            "name": "Listen",
            "desc": "Listen to a network event",
            "params": [
                {
                    "name": "rawListener",
                    "desc": "",
                    "lua_type": "(player: Player?, ...any) -> ()"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 87,
                "path": "src/roket/module/NetEvent.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "LoadOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Id",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "Unreliable",
                    "lua_type": "boolean",
                    "desc": ""
                },
                {
                    "name": "Middlewares",
                    "lua_type": "{ Fire: Middlewares, Listen: Middlewares }",
                    "desc": ""
                }
            ],
            "source": {
                "line": 28,
                "path": "src/roket/module/NetEvent.luau"
            }
        }
    ],
    "name": "NetEvent",
    "desc": "Network Event\n\nAllows for client-server communication.\n\nBase class that all the Roket networking functionality is based on.",
    "source": {
        "line": 18,
        "path": "src/roket/module/NetEvent.luau"
    }
}