Relay — A Clean Remote System for Roblox [Open Source]

Hey, been working on Roblox games for a few years now and one thing that always annoyed me was how messy remotes get as a game grows. RemoteEvents with no structure, random names, no consistency — you know how it goes.

So I put together Relay, a small module that wraps all of Roblox’s remote types into one clean API. No more scattered remotes or wondering which script owns what. You just require it and go.

What it supports

RemoteEvent, RemoteFunction, UnreliableRemoteEvent, BindableEvent and BindableFunction — all in one place.

Features

One require that automatically works on both server and client. Remotes are created lazily so nothing gets made until it’s actually needed. You can group remotes using namespacing like “Shop/Buy” or “Player/Damage” just to keep things organized. Every listener returns a Connection so you can disconnect whenever you want. There’s also a Once variant that auto-disconnects after the first fire, a FireList for firing to a specific set of players, middleware support to intercept and block remotes, and a debug mode per side that logs everything going through Relay.

Setup

Drop a ModuleScript named Relay into ReplicatedStorage with Client, Server, Registry and Types as children. Require it from any script and you’re done.

Basic usage

local Relay = require(ReplicatedStorage:WaitForChild("Relay"))

Relay.Server.On("BuyItem", function(Player, Item)
    print(Player.Name, "bought", Item)
end)

Relay.Client.Fire("BuyItem", "Sword")

Relay.Server.Fire(Player, "Notify", "Purchase successful!")

Relay.Server.OnInvoke("GetCoins", function(Player)
    return 500
end)
local Coins = Relay.Client.Invoke("GetCoins")

Relay.Server.Use(function(Name, Player, ...)
    if Name == "Blocked" then return false end
end)

Just a heads up — this was put together pretty quickly so there may be bugs here and there. If you run into anything feel free to drop it below and I’ll look into it. Feedback welcome.
Relay 1.0.rbxm (5.0 KB)

1 Like

What’s the difference between this and packet or bytenet

2 Likes

Both ByteNet and Packet serialize data into buffers and Packet even batches everything into a single remote, so they’re genuinely more performant than Relay.
Relay doesn’t do any of that, it’s just a cleaner wrapper around Roblox’s built in remotes. The tradeoff is it’s way simpler to use, no packet structures to define, and it covers Bindables, middleware and some extra utilities that neither of them have out of the box. Different tools for different needs really.

1 Like