Skip to main content

RemoteSignal

This item only works when running on the server. Server

A remote signal in layman's terms is simply an object which dispatches data to a client (who can listen to this data through a client remote signal) and listens to data dispatched to itself by a client (through a client remote signal).

Types

DefaultRemoteSignalConfig

interface DefaultRemoteSignalConfig {
automaticArgumentSerializationAndDeserializationEnabledtrue
globalRateLimit0
useUnreliableRemoteEventfalse
}

DefaultRemoteSignalMiddleware

interface DefaultRemoteSignalMiddleware {
serverEvent{}
}

RemoteSignal

type RemoteSignal = RemoteSignal

RemoteSignalConfig

interface RemoteSignalConfig {
useUnreliableRemoteEventboolean--

determines whether or not the remote signal will use UnreliableRemoteEvent or RemoteEvent internally.

automaticArgumentSerializationAndDeserializationEnabledboolean--

determines whether or not values sent to clients by the remote signal be internally serialized/deserialized or not.

globalRateLimitnumber--

(in seconds) will serve as the global rate limit for all players firing to this RemoteSignal.

}
  • automaticArgumentSerializationAndDeserializationEnabled -> true

    • Arguments and values sent across the network by the remote signal will be automatically serialized and deserialized respectively, with the help of an internal library, i.e serializerUtil.
    Serialization and deserialization limitations

    While the serializer utility used to accomplish this supports a variety of data types, do keep in mind that not all data types can be supported on the go for serialization and deserialization - check the above hyperlink to the serializer utility on how many data types it supports.

::::

**See the type of the value sent to the client by the remote signal, being `TweenInfo` on the client**:

```lua
-- Server
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")

local testNetwork = network.Server.new("TestNetwork")
local remoteSignal = network.Server.RemoteSignal.new()
testNetwork:append("remoteSignal",  remoteSignal) 
testNetwork:dispatch(Workspace)

remoteSignal:fireClient(Players:GetPlayers()[1] or Players.PlayerAdded:Wait())

-- Client
local Workspace = game:GetService("Workspace")

local testNetwork = network.client.fromParent("TestNetwork", Workspace):expect()
testNetwork.remoteSignal:connect(function(value)
	print(typeof(value)) --> "TweenInfo"
end)
```
  • automaticArgumentSerializationAndDeserializationEnabled -> false

    • Arguments and values sent across the network by the remote signal will not be internally serialized and deserialized. Using the same example as above:

    See the type of the value sent to the client by the remote signal, being TweenInfo on the client:

    -- Server
    local Workspace = game:GetService("Workspace")
    local Players = game:GetService("Players")
    
    local testNetwork = network.Server.new("TestNetwork")
    local remoteSignal = network.Server.RemoteSignal.new()
    testNetwork:append("remoteSignal",  remoteSignal) 
    testNetwork:dispatch(Workspace)
    
    remoteSignal:fireClient(Players:GetPlayers()[1] or Players.PlayerAdded:Wait())
    
    -- Client
    local Workspace = game:GetService("Workspace")
    
    local testNetwork = network.client.fromParent("TestNetwork", Workspace):expect()
    testNetwork.remoteSignal:connect(function(value)
    	print(typeof(value)) --> "table"
    end)
    

RemoteSignalMiddleware

interface RemoteSignalMiddleware {
serverEvent{(
remoteSignalRemoteSignal,
clientPlayer,
args{any}
) → any}?,
}
Yielding in middleware callbacks is not allowed

Middleware callbacks aren't allowed to yield. If they do so, their thread will be closed via coroutine.close and an error will be outputted in the console.

Yielding, (especially in network-related code) results in weird bugs and behavior which can be hard to track down!

serverEvent

Callbacks in serverEvent are called whenever the client fires off the remote signal.

The first argument passed to each callback is a reference to the remote signal itself, which is followed by the client itself, which is followed by an array of arguments fired by the client.

local serverEventCallbacks = {
	function (remoteSignal, client: Player, arguments)
		print(RemoteSignal.is(remoteSignal)) --> true
		print(client:IsA("Player")) --> true 
		print(typeof(arguments)) --> "table"
	end
}
---
More control
  • If any of the callbacks return an explicit false value, then the remote signal will not be fired. For e.g:
-- Server
local Workspace = game:GetService("Workspace")

local testNetwork = network.Server.new("TestNetwork")
local testRemoteSignal = network.Server.RemoteSignal.new({
	serverEvent = {function() return false end}
})

testRemoteSignal:connect(function()
	print("Fired") --> never prints
end)

testNetwork:append("signal", testRemoteSignal)
testNetwork:dispatch(Workspace)

-- Client
local Workspace = game:GetService("Workspace")

local testNetwork = network.client.fromParent("TestNetwork", Workspace)
print(testNetwork.signal:fireServer()) 
  • Additionally, you can modify the arguments table before it is passed to the connected callback, for e.g:
-- Server
local Workspace = game:GetService("Workspace")

local testNetwork = network.Server.new("TestNetwork")
local testRemoteSignal = network.Server.RemoteSignal.new({
	serverEvent = {
		function(_, arguments) 
			arguments[2] = 5 
			arguments[3] = "test"
		end
	}
})

testRemoteSignal:connect(function(client, a, b)
	print(a, b) --> 5, "test" (a and b ought to be 1 and 24 respectively, but they were modified through the middleware)
end)

testNetwork:append("signal", testRemoteSignal)
testNetwork:dispatch(Workspace)

-- Client
local Workspace = game:GetService("Workspace")

local testNetwork = network.client.fromParent("Test", Workspace):expect()
print(testNetwork.signal:fireServer(1, 24)) 

Functions

new

RemoteSignal.new(
remoteSignalConfigRemoteSignalConfig
) → RemoteSignal

Creates and returns a new remote signal.

is

RemoteSignal.is(selfany) → boolean

Returns a boolean indicating if self is a remote signal or not.

connect

RemoteSignal instance
RemoteSignal:connect(callback(
clientPlayer,
...any
) → ()) → RBXScriptConnection

Connects callback to the remote signal so that it is called whenever the client fires the remote signal. Additionally, callback will be passed all the arguments sent by the client.

-- Server
remoteSignal:connect(function(client, a, b)
	print(a + b) --> 3
end)

-- Client
clientRemoteSignal:fireServer(1, 2)
Possible Rate Limit

It is possible that the client firing to this remote signal is intercepted by a rate-limit, either due to the global rate limit imposed on this remote signal for all players, or a specific-rate limit imposed for this client.

local remoteSignal = RemoteSignal.new(nil, 10) -- global rate limit of 10 seconds
-- Server
remoteSignal:connect(function()
	print("Fired")
end)

--> "Fired" 
-- Only printed once!

-- Client
for _ = 1, 5 do
	clientRemoteSignal:fireServer()
end

If you do not desire this behavior, you can do the following:

once

RemoteSignal instance
RemoteSignal:once(callback(
clientPlayer,
...any
) → ()) → RBXScriptConnection

Works almost exactly the same as RemoteSignal:connect, except the connection returned is disconnected immediately upon callback being called.

wait

RemoteSignal instance
RemoteSignal:wait() → ...any

Connects callback to the remote signal so that it is called whenever the remote signal is fired off by the client successfully. Additionally, callback will be passed all the arguments sent by the client.

-- Server
remoteSignal:connect(function(client, a, b)
	print(a + b) --> 3
end)

-- Client
clientRemoteSignal:fireServer(1, 2)

wait

RemoteSignal instance
RemoteSignal:wait() → ...any

Yields the current thread until the remote signal is successfully fired off by the client. The yielded thread is resumed once the client fires some data to the server successfully, with the arguments sent by the client.

-- Server
local client, a, b = remoteSignal:wait()
print(a + b) --> 3

-- Client
clientRemoteSignal:fireServer(1, 2)

setGlobalRateLimit

RemoteSignal instance
RemoteSignal:setGlobalRateLimit(globalRateLimitnumber) → ()

Sets the given remote signal's global rate limit - clients firing to this remote signal will be ignored if the time (in seconds) between their last fire and the new fire is less than globalRateLimit.

-- Server
remoteSignal:setGlobalRateLimit(10) -- 10 seconds

remoteSignal:Connect(function(client)
	print("2")
end)

--> "2"

-- Client
for _ = 1, 100 do 
	clientRemoteSignal:Fire() -- Only 1 fire call will be respected by the server, rest will be ignored!
end
NOTE

Clients who have a specific rate limit set through RemoteSignal:setClientSpecificRateLimit will not be affected by this global rate limit.

globalRateLimit

RemoteSignal instance
RemoteSignal:globalRateLimit() → number

Returns the remote signal's global rate limit. Defaults to 0.

clientSpecificRateLimit

RemoteSignal instance
RemoteSignal:clientSpecificRateLimit(clientPlayer) → number?

Returns the given client's rate liimt set specifically on them.

setClientSpecificRateLimit

RemoteSignal instance
RemoteSignal:setClientSpecificRateLimit(
clientPlayer,
rateLimitnumber
) → ()

Sets a specific rate limit for the given client.

NOTE

This specific rate limit set for this client will be removed once the client leaves the game.

setClientSpecificRateLimits

RemoteSignal instance
RemoteSignal:setClientSpecificRateLimits(
clients{Player},
rateLimitnumber
) → ()

Wrapper for RemoteSignal:setClientSpecificRateLimit for an array of clients.

removeClientSpecificRateLimit

RemoteSignal instance
RemoteSignal:removeClientSpecificRateLimit(clientPlayer) → ()

Removes the specific rate limit set for the given client through RemoteSignal:setClientSpecificRateLimit.

Global Rate Limit

If the remote signal has a global rate limit set (see RemoteSignal.new's second parameter), then the given client will now be subject to that global rate limit.

If you do not desire this behavior and want the rate limit imposation completely lifted for the client, you should set a specific rate limit of 0 for the given client (through RemoteSignal:setClientSpecificRateLimit).

removeClientSpecificRateLimits

RemoteSignal instance
RemoteSignal:removeClientSpecificRateLimits(clients{Player}) → ()

Wrapper for RemoteSignal:removeClientSpecificRateLimit for an array of clients.

fireClient

RemoteSignal instance
RemoteSignal:fireClient(
clientPlayer,
...any
) → ()

Fires the given arguments to client.

fireAllClients

RemoteSignal instance
RemoteSignal:fireAllClients(...any) → ()

Calls RemoteSignal:fireClient for every player in the game, passing in the given arguments along.

fireClients

RemoteSignal instance
RemoteSignal:fireClients(
clients{Player},
...any
) → ()

Iterates through clients and calls RemoteSignal:fireClient for each client, passing in the given arguments along.

fireAllClientsExcept

RemoteSignal instance
RemoteSignal:fireAllClientsExcept(
clientPlayer,
...any
) → ()

Calls RemoteSignal:fireClient for every player in the game, except for client, passing in the given arguments along.

destroy

RemoteSignal instance
RemoteSignal:destroy() → ()

Destroys the remote signal and renders it unusable.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Creates and returns a new remote signal. \n\n- If the 2nd parameter `middleware` is not specified, then it will default to [DefaultRemoteSignalMiddleware] instead.\n- If the 3rd parameter `remoteSignalConfig` is not specified, then it will default to [DefaultRemoteSignalConfig] instead.",
            "params": [
                {
                    "name": "middleware",
                    "desc": "",
                    "lua_type": "RemoteSignalMiddleware"
                },
                {
                    "name": "remoteSignalConfig",
                    "desc": "",
                    "lua_type": "RemoteSignalConfig"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RemoteSignal\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 215,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "is",
            "desc": "Returns a boolean indicating if `self` is a remote signal or not.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 259,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "connect",
            "desc": "Connects `callback` to the remote signal so that it is called whenever the client\nfires the remote signal. Additionally, `callback` will be passed all the arguments sent \nby the client.  \n\n```lua\n-- Server\nremoteSignal:connect(function(client, a, b)\n\tprint(a + b) --> 3\nend)\n\n-- Client\nclientRemoteSignal:fireServer(1, 2)\n```\n\n:::warning Possible Rate Limit\nIt is possible that the client firing to this remote signal is intercepted by a rate-limit, either\ndue to the global rate limit imposed on this remote signal for all players, or a specific-rate limit\nimposed for this client.\n\n```lua\nlocal remoteSignal = RemoteSignal.new(nil, 10) -- global rate limit of 10 seconds\n-- Server\nremoteSignal:connect(function()\n\tprint(\"Fired\")\nend)\n\n--> \"Fired\" \n-- Only printed once!\n\n-- Client\nfor _ = 1, 5 do\n\tclientRemoteSignal:fireServer()\nend\n```\n\nIf you do not desire this behavior, you can do the following:\n\t\n- Set a specific rate limit for the client through [RemoteSignal:setClientSpecificRateLimit] or [RemoteSignal:setClientSpecificRateLimits], to `0`.\n- Not impose a global rate limit to the remote signal (See [RemoteSignalConfig] for more info).\n:::",
            "params": [
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(client: Player, ...any) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection\n"
                }
            ],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 308,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "once",
            "desc": "Works almost exactly the same as [RemoteSignal:connect], except the \nconnection returned is  disconnected immediately upon `callback` being called.",
            "params": [
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(client: Player, ...any) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection\n"
                }
            ],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 328,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "wait",
            "desc": "Connects `callback` to the remote signal so that it is called whenever the remote signal\nis fired off by the client *successfully*. Additionally, `callback` will be passed all the arguments sent \nby the client.\n\n```lua\n-- Server\nremoteSignal:connect(function(client, a, b)\n\tprint(a + b) --> 3\nend)\n\n-- Client\nclientRemoteSignal:fireServer(1, 2)\n```",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "...any\n"
                }
            ],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 352,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "wait",
            "desc": "Yields the current thread until the remote signal is *successfully* fired off by the client. \nThe yielded thread is resumed once the client fires some data to the server *successfully*, \nwith the arguments sent by the client.\n\n```lua\n-- Server\nlocal client, a, b = remoteSignal:wait()\nprint(a + b) --> 3\n\n-- Client\nclientRemoteSignal:fireServer(1, 2)\n```",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "...any\n"
                }
            ],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 369,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "setGlobalRateLimit",
            "desc": "Sets the given remote signal's global rate limit - clients firing to this remote signal will be ignored\nif the time (in seconds) between their last fire and the new fire is less than `globalRateLimit`.\n\n```lua\n-- Server\nremoteSignal:setGlobalRateLimit(10) -- 10 seconds\n\nremoteSignal:Connect(function(client)\n\tprint(\"2\")\nend)\n\n--> \"2\"\n\n-- Client\nfor _ = 1, 100 do \n\tclientRemoteSignal:Fire() -- Only 1 fire call will be respected by the server, rest will be ignored!\nend\n```\n\n:::note\nClients who have a specific rate limit set through [RemoteSignal:setClientSpecificRateLimit] will **not** be\naffected by this global rate limit.\n:::",
            "params": [
                {
                    "name": "globalRateLimit",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 407,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "globalRateLimit",
            "desc": "Returns the remote signal's global rate limit. Defaults to `0`.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 417,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "clientSpecificRateLimit",
            "desc": "Returns the given `client`'s rate liimt set specifically on them.",
            "params": [
                {
                    "name": "client",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number?\n"
                }
            ],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 427,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "setClientSpecificRateLimit",
            "desc": "Sets a specific rate limit for the given client.\n\n:::note\nThis specific rate limit set for this client will be **removed** once the client leaves the game.\n:::",
            "params": [
                {
                    "name": "client",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "rateLimit",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 441,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "setClientSpecificRateLimits",
            "desc": "Wrapper for [RemoteSignal:setClientSpecificRateLimit] for an array of clients.",
            "params": [
                {
                    "name": "clients",
                    "desc": "",
                    "lua_type": "{ Player }"
                },
                {
                    "name": "rateLimit",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 451,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "removeClientSpecificRateLimit",
            "desc": "Removes the **specific rate limit set** for the given client through [RemoteSignal:setClientSpecificRateLimit].\n\n:::note Global Rate Limit \nIf the remote signal has a global rate limit set (see [RemoteSignal.new]'s second parameter), then\nthe given client will now be subject to that global rate limit. \n\nIf you do not desire this behavior and want the rate limit imposation completely lifted for the client, \nyou should set a specific rate limit of `0` for the given client (through [RemoteSignal:setClientSpecificRateLimit]).\n:::",
            "params": [
                {
                    "name": "client",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 471,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "removeClientSpecificRateLimits",
            "desc": "Wrapper for [RemoteSignal:removeClientSpecificRateLimit] for an array of clients.",
            "params": [
                {
                    "name": "clients",
                    "desc": "",
                    "lua_type": "{ Player }"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 481,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "fireClient",
            "desc": "Fires the given arguments to `client`.",
            "params": [
                {
                    "name": "client",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 493,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "fireAllClients",
            "desc": "Calls [RemoteSignal:fireClient] for every player in the game, passing in the given arguments along.",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 503,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "fireClients",
            "desc": "Iterates through `clients` and calls [RemoteSignal:fireClient] for each client, \npassing in the given arguments along.",
            "params": [
                {
                    "name": "clients",
                    "desc": "",
                    "lua_type": "{ Player }"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 516,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "fireAllClientsExcept",
            "desc": "Calls [RemoteSignal:fireClient] for every player in the game, except for `client`, \npassing in the given arguments along.",
            "params": [
                {
                    "name": "client",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 529,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "destroy",
            "desc": "Destroys the remote signal and renders it unusable.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "tags": [
                "RemoteSignal instance"
            ],
            "source": {
                "line": 545,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "DefaultRemoteSignalConfig",
            "desc": " ",
            "fields": [
                {
                    "name": "automaticArgumentSerializationAndDeserializationEnabled",
                    "lua_type": "true",
                    "desc": ""
                },
                {
                    "name": "globalRateLimit",
                    "lua_type": "0",
                    "desc": ""
                },
                {
                    "name": "useUnreliableRemoteEvent",
                    "lua_type": "false",
                    "desc": ""
                }
            ],
            "source": {
                "line": 18,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "DefaultRemoteSignalMiddleware",
            "desc": "",
            "fields": [
                {
                    "name": "serverEvent",
                    "lua_type": "{}",
                    "desc": ""
                }
            ],
            "source": {
                "line": 24,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "RemoteSignal",
            "desc": " ",
            "lua_type": "RemoteSignal",
            "source": {
                "line": 29,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "RemoteSignalConfig",
            "desc": " \n\n- `automaticArgumentSerializationAndDeserializationEnabled` -> `true`\n\t- Arguments and values sent across the network by the remote signal \n\twill be automatically serialized and deserialized respectively, with the\n\thelp of an internal library, i.e [serializerUtil](https://babypatrick100.github.io/libraries/api/serializerUtil/).\n\n\t:::note Serialization and deserialization limitations\n\tWhile the serializer utility used to accomplish this supports a variety of data types, do keep in mind that not all data types\n\tcan be supported on the go for serialization and deserialization - check the above hyperlink to the serializer utility on how\n\tmany data types it supports.\n\t::::\n\n\t**See the type of the value sent to the client by the remote signal, being `TweenInfo` on the client**:\n\n\t```lua\n\t-- Server\n\tlocal Workspace = game:GetService(\"Workspace\")\n\tlocal Players = game:GetService(\"Players\")\n\n\tlocal testNetwork = network.Server.new(\"TestNetwork\")\n\tlocal remoteSignal = network.Server.RemoteSignal.new()\n\ttestNetwork:append(\"remoteSignal\",  remoteSignal) \n\ttestNetwork:dispatch(Workspace)\n\n\tremoteSignal:fireClient(Players:GetPlayers()[1] or Players.PlayerAdded:Wait())\n\n\t-- Client\n\tlocal Workspace = game:GetService(\"Workspace\")\n\n\tlocal testNetwork = network.client.fromParent(\"TestNetwork\", Workspace):expect()\n\ttestNetwork.remoteSignal:connect(function(value)\n\t\tprint(typeof(value)) --> \"TweenInfo\"\n\tend)\n\t```\n- `automaticArgumentSerializationAndDeserializationEnabled` -> `false`\n\t- Arguments and values sent across the network by the remote signal will not be internally serialized\n\tand deserialized. Using the same example as above:\n\t\n\t**See the type of the value sent to the client by the remote signal, being `TweenInfo` on the client**:\n\n\t```lua\n\t-- Server\n\tlocal Workspace = game:GetService(\"Workspace\")\n\tlocal Players = game:GetService(\"Players\")\n\n\tlocal testNetwork = network.Server.new(\"TestNetwork\")\n\tlocal remoteSignal = network.Server.RemoteSignal.new()\n\ttestNetwork:append(\"remoteSignal\",  remoteSignal) \n\ttestNetwork:dispatch(Workspace)\n\n\tremoteSignal:fireClient(Players:GetPlayers()[1] or Players.PlayerAdded:Wait())\n\n\t-- Client\n\tlocal Workspace = game:GetService(\"Workspace\")\n\n\tlocal testNetwork = network.client.fromParent(\"TestNetwork\", Workspace):expect()\n\ttestNetwork.remoteSignal:connect(function(value)\n\t\tprint(typeof(value)) --> \"table\"\n\tend)\n\t```",
            "fields": [
                {
                    "name": "useUnreliableRemoteEvent",
                    "lua_type": "boolean",
                    "desc": "determines whether or not the remote signal will use `UnreliableRemoteEvent` or `RemoteEvent` internally."
                },
                {
                    "name": "automaticArgumentSerializationAndDeserializationEnabled",
                    "lua_type": "boolean",
                    "desc": "determines whether or not values sent to clients by the remote signal be internally serialized/deserialized or not."
                },
                {
                    "name": "globalRateLimit",
                    "lua_type": "number",
                    "desc": "(in seconds) will serve as the global rate limit for all players firing to this RemoteSignal."
                }
            ],
            "source": {
                "line": 97,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        },
        {
            "name": "RemoteSignalMiddleware",
            "desc": ":::warning Yielding in middleware callbacks is not allowed\nMiddleware callbacks aren't allowed to yield. If they do so, their thread will be closed via\n[coroutine.close](https://create.roblox.com/docs/reference/engine/libraries/coroutine#close) and an\nerror will be outputted in the console.\n\nYielding, (especially in network-related code) results in weird bugs and behavior which can be hard to track down!\n:::\n\n### `serverEvent` \n\nCallbacks in `serverEvent` are called whenever the client fires off the remote signal.\n\nThe first argument passed to each callback is a reference to the remote signal itself,\nwhich is followed by the client itself, which is followed by an array of arguments fired \nby the client. \n\n```lua\nlocal serverEventCallbacks = {\n\tfunction (remoteSignal, client: Player, arguments)\n\t\tprint(RemoteSignal.is(remoteSignal)) --> true\n\t\tprint(client:IsA(\"Player\")) --> true \n\t\tprint(typeof(arguments)) --> \"table\"\n\tend\n}\n---\n```\n\n:::tip More control\n- If any of the callbacks return an **explicit** false value, then the remote signal\nwill not be fired. For e.g:\n\n```lua\n-- Server\nlocal Workspace = game:GetService(\"Workspace\")\n\nlocal testNetwork = network.Server.new(\"TestNetwork\")\nlocal testRemoteSignal = network.Server.RemoteSignal.new({\n\tserverEvent = {function() return false end}\n})\n\ntestRemoteSignal:connect(function()\n\tprint(\"Fired\") --> never prints\nend)\n\ntestNetwork:append(\"signal\", testRemoteSignal)\ntestNetwork:dispatch(Workspace)\n\n-- Client\nlocal Workspace = game:GetService(\"Workspace\")\n\nlocal testNetwork = network.client.fromParent(\"TestNetwork\", Workspace)\nprint(testNetwork.signal:fireServer()) \n```\n\n- Additionally, you can modify the `arguments` table before it is passed to the connected callback, for e.g:\n\n```lua\n-- Server\nlocal Workspace = game:GetService(\"Workspace\")\n\nlocal testNetwork = network.Server.new(\"TestNetwork\")\nlocal testRemoteSignal = network.Server.RemoteSignal.new({\n\tserverEvent = {\n\t\tfunction(_, arguments) \n\t\t\targuments[2] = 5 \n\t\t\targuments[3] = \"test\"\n\t\tend\n\t}\n})\n\ntestRemoteSignal:connect(function(client, a, b)\n\tprint(a, b) --> 5, \"test\" (a and b ought to be 1 and 24 respectively, but they were modified through the middleware)\nend)\n\ntestNetwork:append(\"signal\", testRemoteSignal)\ntestNetwork:dispatch(Workspace)\n\n-- Client\nlocal Workspace = game:GetService(\"Workspace\")\n\nlocal testNetwork = network.client.fromParent(\"Test\", Workspace):expect()\nprint(testNetwork.signal:fireServer(1, 24)) \n```\n:::",
            "fields": [
                {
                    "name": "serverEvent",
                    "lua_type": "{ (remoteSignal: RemoteSignal, client: Player, args: {any}) -> any }?,",
                    "desc": ""
                }
            ],
            "source": {
                "line": 187,
                "path": "src/network/Server/RemoteSignal.luau"
            }
        }
    ],
    "name": "RemoteSignal",
    "desc": "A remote signal in layman's terms is simply an object which dispatches data\nto a client (who can listen to this data through a client remote signal) and \nlistens to data dispatched to itself by a client (through a client remote signal).",
    "realm": [
        "Server"
    ],
    "source": {
        "line": 9,
        "path": "src/network/Server/RemoteSignal.luau"
    }
}