Skip to content

Remote ​

Single-remote networking wrapper with byte-packed IDs and auto-batching.

Standard Roblox networking often involves creating many RemoteEvents. However, this creates network overhead because every unique RemoteEvent adds its own packet header and protocol metadata.

When multiple calls are made on the same RemoteEvent within a single frame, the engine merges them into one packet sequence separated by 0x00 (null) delimiters.

This module exploits that behavior:

  1. It funnels all game traffic through a single RemoteEvent (and one UnreliableRemoteEvent).
  2. It assigns short, byte-packed IDs (1-2 bytes) to logical events.
  3. Result: Massive reduction in packet overhead (headers/delimiters) and automatic queueing.

Key features ​

  • Lazy Instantiation: Just do Remote.MyEvent. If it doesn't exist, it's created.
  • Auto-Synchronization: Clients automatically wait for the server to replicate IDs. No WaitForChild required.
  • Byte-Packing: IDs are compressed to 1 byte (for the first 256 events) or 2 bytes.
  • Reliability Toggling: Switch an event to Unreliable mode on the fly.

API reference ​

luau
-- Shared
Remote.EventName:Connect(callback)     --> RBXScriptConnection
Remote.EventName:Once(callback)        --> RBXScriptConnection
Remote.EventName:Wait()                --> ...any

-- Server
Remote.EventName:Fire(player, ...)     --> void
Remote.EventName:FireAll(...)          --> void
Remote.FuncName:Invoke(player, ...)    --> ...any (invokes the client)
Remote.EventName:SetUnreliable(bool)   --> void (switches transport method)
Remote.FuncName.OnInvoke = (...) -> ...any

-- Client
Remote.EventName:Fire(...)             --> void
Remote.FuncName:Invoke(...)            --> ...any (invokes the server)
Remote.FuncName.OnInvoke = (...) -> ...any

Usage ​

luau
-- Server
local Remote = require(ReplicatedStorage.Remote)

Remote.GetGold.OnInvoke = function(player)
	return 100
end

task.wait(5)

Remote.Combat:FireAll("FightStarted")

-- Client
local Remote = require(ReplicatedStorage.Remote)
Remote.Combat:Connect(function(status) print(status) end) -- Prints "FightStarted"
print(Remote.GetGold:Invoke()) -- Prints 100

Types ​

RemoteData type ​

luau
type RemoteData = {
	_key: string,
	_id: string?,
	_signal: Signal.Signal,
	_remote: RemoteEvent | UnreliableRemoteEvent,
	_fireQueue: { { any } }?,
	_invokeQueue: { { any } }?,
	OnInvoke: ((...any) -> ...any)?,
}

Remote type ​

luau
type Remote = typeof(setmetatable({} :: RemoteData, RemoteObject))

Methods ​

Connect ​

luau
Remote:Connect(callback: (...any) -> ()): Signal.Connection

Once ​

luau
Remote:Once(callback: (...any) -> ()): ...any?

Wait Yields ​

luau
Remote:Wait(): ...any?

FireAll Server ​

luau
Remote:FireAll(...)

SetUnreliable Server ​

luau
Remote:SetUnreliable(state: boolean)

Fire Client ​

luau
Remote:Fire(...)

Invoke Yields Client ​

luau
Remote:Invoke(...): ...any