Skip to main content

ServerRemoteEvent

This item only works when running on the server. Server

Server-side remote event class providing comprehensive event functionality. Based on Sleitnick's Comm RemoteSignal implementation.

Functions

Connect

ServerRemoteEvent:Connect(fn(
playerPlayer,
...any
) → nil) → Connection

Connect a function to the signal. Anytime a matching ClientRemoteEvent on a client fires, the connected function will be invoked with the arguments passed by the client.

Fire

ServerRemoteEvent:Fire(
playerPlayer,--

The target client

...any--

Arguments passed to the client

) → ()

Fires the signal at the specified client with any arguments.

Outbound Middleware

All arguments pass through any outbound middleware (if any) before being sent to the clients.

FireAll

ServerRemoteEvent:FireAll(...any) → ()

Fires the signal at all clients with any arguments.

Outbound Middleware

All arguments pass through any outbound middleware (if any) before being sent to the clients.

FireExcept

ServerRemoteEvent:FireExcept(
ignorePlayerPlayer,--

The client to ignore

...any--

Arguments passed to the other clients

) → ()

Fires the signal to all clients except the specified client.

Outbound Middleware

All arguments pass through any outbound middleware (if any) before being sent to the clients.

FireFilter

ServerRemoteEvent:FireFilter(
predicate(
playerPlayer,
argsFromFire...
) → boolean,
...any--

Arguments to pass to the clients (and to the predicate)

) → ()

Fires the signal at any clients that pass the predicate function test. This can be used to fire signals with much more control logic.

Outbound Middleware

All arguments pass through any outbound middleware (if any) before being sent to the clients.

Predicate Before Middleware

The arguments sent to the predicate are sent before getting transformed by any middleware.

-- Fire signal to players of the same team:
remoteSignal:FireFilter(function(player)
	return player.Team.Name == "Best Team"
end)

FireFor

ServerRemoteEvent:FireFor(
players{Player},
...any
) → ()

Fires a signal at the clients within the players table. This is useful when signals need to fire for a specific set of players.

For more complex firing, see FireFilter.

Outbound Middleware

All arguments pass through any outbound middleware (if any) before being sent to the clients.

local players = {somePlayer1, somePlayer2, somePlayer3}
remoteSignal:FireFor(players, "Hello, players!")

IsUnreliable

ServerRemoteEvent:IsUnreliable() → boolean

Returns whether this remote event is unreliable (uses UnreliableRemoteEvent).

Show raw api
{
    "functions": [
        {
            "name": "Connect",
            "desc": "Connect a function to the signal. Anytime a matching ClientRemoteEvent\non a client fires, the connected function will be invoked with the\narguments passed by the client.",
            "params": [
                {
                    "name": "fn",
                    "desc": "",
                    "lua_type": "(player: Player, ...: any) -> nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Connection"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 97,
                "path": "lib/netwire/src/NetWireTypes.luau"
            }
        },
        {
            "name": "Fire",
            "desc": "Fires the signal at the specified client with any arguments.\n\n:::note Outbound Middleware\nAll arguments pass through any outbound middleware (if any)\nbefore being sent to the clients.\n:::",
            "params": [
                {
                    "name": "player",
                    "desc": "The target client",
                    "lua_type": "Player"
                },
                {
                    "name": "...",
                    "desc": "Arguments passed to the client",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 111,
                "path": "lib/netwire/src/NetWireTypes.luau"
            }
        },
        {
            "name": "FireAll",
            "desc": "Fires the signal at _all_ clients with any arguments.\n\n:::note Outbound Middleware\nAll arguments pass through any outbound middleware (if any)\nbefore being sent to the clients.\n:::",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 124,
                "path": "lib/netwire/src/NetWireTypes.luau"
            }
        },
        {
            "name": "FireExcept",
            "desc": "Fires the signal to all clients _except_ the specified\nclient.\n\n:::note Outbound Middleware\nAll arguments pass through any outbound middleware (if any)\nbefore being sent to the clients.\n:::",
            "params": [
                {
                    "name": "ignorePlayer",
                    "desc": "The client to ignore",
                    "lua_type": "Player"
                },
                {
                    "name": "...",
                    "desc": "Arguments passed to the other clients",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 139,
                "path": "lib/netwire/src/NetWireTypes.luau"
            }
        },
        {
            "name": "FireFilter",
            "desc": "Fires the signal at any clients that pass the `predicate`\nfunction test. This can be used to fire signals with much\nmore control logic.\n\n:::note Outbound Middleware\nAll arguments pass through any outbound middleware (if any)\nbefore being sent to the clients.\n:::\n\n:::caution Predicate Before Middleware\nThe arguments sent to the predicate are sent _before_ getting\ntransformed by any middleware.\n:::\n\n```lua\n-- Fire signal to players of the same team:\nremoteSignal:FireFilter(function(player)\n\treturn player.Team.Name == \"Best Team\"\nend)\n```",
            "params": [
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "(player: Player, argsFromFire: ...) -> boolean"
                },
                {
                    "name": "...",
                    "desc": "Arguments to pass to the clients (and to the predicate)",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 167,
                "path": "lib/netwire/src/NetWireTypes.luau"
            }
        },
        {
            "name": "FireFor",
            "desc": "Fires a signal at the clients within the `players` table. This is\nuseful when signals need to fire for a specific set of players.\n\nFor more complex firing, see `FireFilter`.\n\n:::note Outbound Middleware\nAll arguments pass through any outbound middleware (if any)\nbefore being sent to the clients.\n:::\n\n```lua\nlocal players = {somePlayer1, somePlayer2, somePlayer3}\nremoteSignal:FireFor(players, \"Hello, players!\")\n```",
            "params": [
                {
                    "name": "players",
                    "desc": "",
                    "lua_type": "{Player}"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 189,
                "path": "lib/netwire/src/NetWireTypes.luau"
            }
        },
        {
            "name": "IsUnreliable",
            "desc": "Returns whether this remote event is unreliable (uses UnreliableRemoteEvent).",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 197,
                "path": "lib/netwire/src/NetWireTypes.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ServerRemoteEvent",
    "desc": "Server-side remote event class providing comprehensive event functionality.\nBased on Sleitnick's Comm RemoteSignal implementation.",
    "realm": [
        "Server"
    ],
    "source": {
        "line": 86,
        "path": "lib/netwire/src/NetWireTypes.luau"
    }
}