Easy communication across your game with Reflex

Reflex

Wiki | Github

Reflex is a Library that makes Communication across your Roblox game easier

Why?

The process for making a RemoteEvent or RemoteFunction can get tedious when you have to do it for every time you want to send something different to the Server or Client, Reflex solves this problem by making a “Shared Space” between the client and the server where you can make functions that the Server and Client can access

Usage and Examples

In the beginning I mentioned the Wiki but here’s a quick example of using RemoteFunctions vs Reflex.

RemoteFunctions

(After making your RemoteFunction in ReplicatedStorage)

-- Server
local NewFunction = game:GetService("ReplicatedStorage").Functions.NewFunction
NewFunction.OnServerInvoke = function(Client, ...)
  -- Run your code here
  return "Something"
end
-- LocalScript
local NewFunction = game:GetService("ReplicatedStorage").Functions.NewFunction
NewFunction:InvokeServer("Test")
Reflex
-- Server
local Reflex = require(game:GetService("ReplicatedStorage").Reflex)
Reflex.SharedFunctions.NewFunction = function(Client, ...)
  -- Run your code here
  return "Something"
end
-- LocalScript
local Reflex = require(game:GetService("ReplicatedStorage").Reflex)
Reflex.SharedFunctions.NewFunction("Test")

I know that the code looks very similar and Reflex may seem like an unnecessary layer of abstraction over RemoteEvents/RemoteFunctions, but I personally think that not having to make RemoteEvents/RemoteFunctions and being able to communicate across the Server and Client by making functions and running them on the other side generates much more readable code than using RemoteEvents/RemoteFunctions which is why I suggest you give Reflex a try even if you don’t think it’s that great.

You can also use Reflex for Server - Server Communication and communication between two scripts of the same type as an alternative to BindableEvents in a similar way as shown in the Wiki

Fast Installation

Paste this into your Command Bar to automatically copy Reflex to your ReplicatedStorage

game:GetService("InsertService"):LoadAsset(7589816540):GetChildren()[1].Parent = game:GetService("ReplicatedStorage")

Normal Installation

Get this model and copy it to ReplicatedStorage

Reflex

What should the next update be?

  • Client - Client Communication
  • Have Reflex automatically know whether you want to make a RemoteFunction or RemoteEvent depending on whether your function returns something or not
  • Ability to create multiple RemoteEvents/RemoteFunctions at a time

0 voters

4 Likes

Woah, bruh. This is literally going to change the way I make scripts forever.
P.S. your ‘Fast Installation’ returns a HTTP 403 (Forbidden Access) Error in the output.
Link to the actual model: Reflex - Roblox
yw
Edit: There are duplicate ‘MsgService’ scripts in the module.

The Fast Install works fine for me and I dont see duplicate MsgService scripts
I’m not too sure what’s going on for you

Edit: Found the duplicate MsgService script and deleted it, still don’t know why the Fast Install didnt work for you though

now it doesnt return a 403 but it just returns what i put in the command bar
sus