Skip to content

cutiekei/Conduit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Conduit

networking wrapper for roblox. declare remotes once in a shared file, fire/invoke from anywhere without touching RemoteEvents directly.

-- Remotes.luau (ReplicatedStorage, required by both sides)
local Conduit = require(ReplicatedStorage.Conduit)

Conduit.declare("Ping", "RemoteEvent")
Conduit.declare("GetData", "RemoteFunction")

return Conduit
-- server
local Conduit = require(ReplicatedStorage.Remotes)

Conduit.onServerEvent("Ping", function(player, msg)
    Conduit.fireClient("Ping", player, "pong!")
end)

Conduit.handleServerInvoke("GetData", function(player)
    return { coins = 100 }
end)
-- client
local Conduit = require(ReplicatedStorage.Remotes)

Conduit.onClientEvent("Ping", function(msg)
    print(msg)
end)

Conduit.fireServer("Ping", "hey")

local data = Conduit.invokeServer("GetData")

remotes must be declared before use. if you forget, you'll get a clear error telling you which one.

install

drop Conduit.luau into ReplicatedStorage. create a Remotes.luau next to it for your declarations.

api

Conduit.declare(name, class) -- "RemoteEvent", "RemoteFunction", or "UnreliableRemoteEvent"

-- client → server
Conduit.fireServer(name, ...)
Conduit.fireServerUnreliable(name, ...)
Conduit.invokeServer(name, ...) → ...

-- server → client
Conduit.fireClient(name, player, ...)
Conduit.fireAllClients(name, ...)
Conduit.fireClients(name, players, ...)
Conduit.invokeClient(name, player, ...) → ...

-- handlers
Conduit.onServerEvent(name, handler) → RBXScriptConnection
Conduit.onServerEventUnreliable(name, handler) → RBXScriptConnection
Conduit.onClientEvent(name, handler) → RBXScriptConnection
Conduit.handleServerInvoke(name, handler)
Conduit.handleClientInvoke(name, handler)

-- optional global intercept (runs before every inbound handler)
Conduit.intercept = function(player, name, ...) → boolean?
    -- return false to block
end

license

MIT

About

networking wrapper for roblox remotes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages