Introduction
Modular Remotes is a utility designed to modularize RemoteEvents and RemoteFunctions.
Managing a large amount of remotes can be a hassle at times, and because of this I created Modular Remotes, free for anyone to use!
This utility is designed for programmers who have experience with the following:
- RemoteEvents and Remote Functions
- Module Scripts
- Object-Oriented Programming
What the system is
Modular Remotes is not a module on its own, it is instead a backend system for networking. This means that it is required to be setup inside of your place, the same as you would do with your own game internals. Although it is recommended to start off with this system from the beginning instead of porting over other systems.
Modular Remotes uses 2 remotes in total to function: A RemoteEvent
and a RemoteFunction
. All of the remote traffic that your game has will be routed through the 2 remotes that this utility implements.
Each Remote Module that you create is basically the same as having a RemoteEvent
and a RemoteFunction
mixed together.
This system is designed to be smaller than most other libraries that achieve similar things, but that is because it was made to be simple and easy to use, as well as heavily modifiable.
Before you read any further, if you want to understand a bit more, then load the asset into a blank studio and see how it works
Documentation
Client Module
-- OBJECT EVENT HOOKS
.ClientEvent(self, ...) --This is executed when the server fires the client
.ClientInvoke(self, ...) --This is executed when the server invokes the client
-- OBJECT METHODS
:Fire(...) --This will fire the server
:Invoke(...) --This will invoke the server, returning a value
Server Module
-- OBJECT EVENT HOOKS
.ServerEvent(self, Player, ...) --This is executed when the client fires the server
.ServerInvoke(self, Player, ...) --This is executed when the client invokes the server
-- OBJECT METHODS
:Fire(Player,...) --This will fire the client of the given player
:FireAll(...) --This will fire the clients of all players
:Invoke(Player,...) --This will invoke the client of the given player, returning a value
More documentation can be found inside the READ ME
script inside the asset (see asset section)
Example Code
Test:Server
(ModuleScript in Server Remotes Folder)
return {
ServerEvent = function(self,Player,Text)
self:Fire(Player,Text)
print(Text," from ServerEvent")
print(self:Invoke(Player,Text))
end,
ServerInvoke = function(self,Player,Text)
print(self.TestVariable)
return Text.." from ServerInvoke"
end,
}
Test:Client
(ModuleScript in Client Remotes Folder)
return {
TestVariable = "Hello, world!",
ClientEvent = function(self,Text)
print(Text," from ClientEvent")
end,
ClientInvoke = function(self,Text)
return Text.." from ClientInvoke"
end,
}
TestScript
(LocalScript in StarterCharacterScripts)
local Remotes = _G.Remotes --This is the global created by the client of Modular Remotes
Remotes.Test:Fire("Test!")
print(Remotes.Test:Invoke("Test!"))
Did you notice something in Test:Server
? The module has access to TestVariable
that is inside of the Test:Client
module.
Modules on the server will inherit all of the methods and properties that are present in their respective client modules. But, the client module will not inherit anything from its server counterpart.
This example can be found inside the asset (see asset section)
Asset
Version History
v0.0
- Created and released