Reflex
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