He is still working on docs, and they will be coming soon.
Are there any preformance cons to using this?
No, not really. If you can find any, post them here.
Iâm waiting for some docs for it lol.
Could you please slide that exquisite Font + Theme?
How would I sent a instance over a Remote from server to client?
EDIT: Figured it out, its because I was using this as a normal remote where I thought I can pass in multiple parameters, turns out I can only put in one parameters and If I want 2 it needs to be a table
Can someone help me with this issue, its really simple so basically I got a bunch of tools that have scripts running on them with Collection Service each of the tools gets a referenceBridge used in them, and sends data to the user using them (for some special effects) and the issue Iâm running into it, is that ReferenceBridge:Fire() stops working for every new tool created, I am making a bridge for each player separately like this:
local BridgeShakeBow = BridgeNet.ReferenceBridge(player.Name.."ShakeBow")
My assumption is that its because Iâm trying to reference a bridge with the same name again (and it only works once and thats when its created), and it somehow doesnât allow it for some reason?
Also some more info: the client side referenceBridge and the :Connect on it gets only run once, and there is no issue with those.
Iâm currently developing my game using BridgeNet2 and Iâm wondering what the current problems/Limitations are. Are there any issues with the Alpha version that would make me unable to use it on a large-scale project?
I did not abandon it, Iâm just busy with real life and a game I need to release to pay for irl things.
Oh, I presumed it was dead considering you havenât replied to any of my messages about the docs but thanks for explaining.
I donât like red because itâs not object oriented. The api is also a little weird, and Bridgenet just makes sense.
Well, red has docs lol, so I guess thatâs something.
Thanks for the cool module.
I found a potential issue. The rate limit implementation in ServerProcess.luau
has an issue because it does not reset the rate counter (self._rateMap[player]
) after a specific time period. As a result, the rate limit will only work until the limit is reached, and then it will be permanently blocked.
To fix it, consider resetting the rate counter using a timer or schedule, for example, every second. This way, the rate limit will work as expected, allowing the specified number of invokes per second:
function ServerBridge:Connect<T>(callback: (player: Player, object: T) -> nil)
ServerProcess._connect(self._identifier, function(player, object)
if self._rateLimiting then
if self._rateMap[player] ~= nil then
self._rateMap[player] += 1
else
self._rateMap[player] = 1
-- Reset the player's count after 1 second
task.delay(1, function()
self._rateMap[player] = nil
end)
end
if self._rateMap[player] > self._maxRate then
if not self._overflowFunction(player) then
return
end
end
end
-- Rest of the code remains the same
end)
end
A simple tutorial:
Create a simple module script named BridgeNetRemoteEvent
in ReplicatedStorage. This script makes use of BridgeNet2 library like Robloxâs RemoteEvents.
Follow these steps:
-
Create a ModuleScript in Roblox Studio:
- In the Explorer window, right-click on âReplicatedStorageâ.
- Click âInsert Objectâ and choose âModuleScriptâ.
- Rename the new ModuleScript to âBridgeNetRemoteEventâ.
-
Copy the following code into the BridgeNetRemoteEvent ModuleScript:
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BridgeNet2 = require(ReplicatedStorage:WaitForChild("BridgeNet2"))
local BridgeNetRemoteEvent = {}
BridgeNetRemoteEvent.__index = BridgeNetRemoteEvent
function BridgeNetRemoteEvent.new(name)
assert(type(name) == "string", "Name must be a string.")
local self = setmetatable({}, BridgeNetRemoteEvent)
self._bridge = BridgeNet2.ReferenceBridge(name)
self._isServer = RunService:IsServer()
return self
end
function BridgeNetRemoteEvent:FireServer(...)
self._bridge:Fire({ ... })
end
function BridgeNetRemoteEvent:FireClient(player, ...)
self._bridge:Fire(BridgeNet2.Players({ player }), { ... })
end
function BridgeNetRemoteEvent:FireClients(players, ...)
self._bridge:Fire(BridgeNet2.Players(players), { ... })
end
function BridgeNetRemoteEvent:FireAllClients(...)
self._bridge:Fire(BridgeNet2.AllPlayers(), { ... })
end
function BridgeNetRemoteEvent:FireClientsExcept(excludePlayers, ...)
self._bridge:Fire(BridgeNet2.PlayersExcept(excludePlayers), { ... })
end
function BridgeNetRemoteEvent:Destroy()
if self._bridge and self._bridge.Destroy then
self._bridge:Destroy()
end
end
function BridgeNetRemoteEvent:Connect(callback)
if self._isServer then
self._bridge:Connect(function(player, args)
callback(player, unpack(args))
end)
else
self._bridge:Connect(function(args)
callback(unpack(args))
end)
end
return self
end
return BridgeNetRemoteEvent
Remember that this script requires the BridgeNet2 library to work. Make sure it is located in ReplicatedStorage. BridgeNet2 Installation Guide
The module BridgeNetRemoteEvent
provides a simple interface for network communication. With functions like FireServer
, FireClient
, and FireAllClients
, you can send data between the server and clients easily. The Connect
function allows you to listen for events and react accordingly.
A simple usage example:
-
Make sure you have the
BridgeNetRemoteEvent
module script in ReplicatedStorage. -
Create a new Script in ServerScriptService, name it âServerScriptâ, and add the following code:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BridgeNetRemoteEvent = require(ReplicatedStorage.BridgeNetRemoteEvent)
local myEvent = BridgeNetRemoteEvent.new("MyEvent")
myEvent:Connect(function(player)
print(player.Name .. " has clicked the button!")
myEvent:FireClient(player, "You clicked the button!")
end)
- Create a new LocalScript in StarterPlayerScripts, name it âClientScriptâ, and add the following code:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BridgeNetRemoteEvent = require(ReplicatedStorage.BridgeNetRemoteEvent)
local player = Players.LocalPlayer
local myEvent = BridgeNetRemoteEvent.new("MyEvent")
myEvent:Connect(function(message)
print(message)
end)
local function onButtonClicked()
myEvent:FireServer()
end
-- Replace this with the actual code to detect a button click in your game
-- For instance, if using a GUI button, you can connect its MouseButton1Click event to onButtonClicked
onButtonClicked() -- simulate a button click
In this example, when a player clicks a button (simulated by calling onButtonClicked()
), the client will fire MyEvent
via FireServer()
. The server listens for this event using the Connect
function, prints a message, and sends a message back to the client using FireClient()
.
On the client side, it listens for the event with another Connect
function, and upon receiving the message from the server, it prints the message.
Replace the example button click detection code with your actual in-game button logic. This can be a part of your UI or an object in the game world that players interact with.
Lifesaver, thank you so much
yeah man you are a lifer saver
Rate Limiting is not working as intended. (As far as I can tell)
It justs runs the overflow function when the remote has been fired a certain number of times regardless of time.
will fix, give me a bit. will be released with a few other things
How do I fix this error?
repeat game:GetService("RunService").RenderStepped:wait() until game.Players.LocalPlayer ~= nil
local MouseAim = game.Players.LocalPlayer:GetMouse()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BridgeNetRemoteEvent = require(ReplicatedStorage.Modules.BridgeNetRemoteEvent)
local myEvent = BridgeNetRemoteEvent.new("VFX")
myEvent:Connect(function(Type,Item,Etc)
local Character = game.Players.LocalPlayer.Character
if Type == "FlameSpark" then
Item.Attachment.Spark:Emit(4)
Item.Attachment.Ring:Emit(20)
elseif Type == "FlameLoop" then
task.spawn(function()
while task.wait() do
if Item:FindFirstChild("Stop") then
break
end
if Item:FindFirstChild("A") then
Item.A.Flame1:Emit(2)
Item.A.Flame2:Emit(2)
Item.A.Flame3:Emit(2)
Item.A.Flame4:Emit(3)
Item.Light.Enabled = true
Item.Light.Range = 2
end
end
end)
elseif Type == "IceSpark" then
if Etc:FindFirstChild("Spark") and Etc:FindFirstChild("Light") then
Item.Attachment.Spark:Emit(20)
Item.Attachment.Spark1:Emit(20)
end
game.TweenService:Create(Etc,TweenInfo.new(0.15,Enum.EasingStyle.Quad),{Transparency = 0}):Play()
task.spawn(function()
while task.wait() do
if Etc:FindFirstChild("Stop") then
break
end
if Etc:FindFirstChild("Spark") and Etc:FindFirstChild("Light") then
Etc.Spark:Emit(2)
Etc.Spark1:Emit(2)
Etc.Light.Enabled = true
Etc.Light.Range = 5
end
end
end)
elseif Type == "EarthAppear" then
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {Character}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(Etc.Position, Etc.CFrame.UpVector * -1000, raycastParams)
if raycastResult then
Etc.Position = raycastResult.Position + Vector3.new(0,-40,0)
Etc.Transparency = 0
local Position = Instance.new("BodyPosition",Etc)
Position.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
Position.P = 5^6
Etc.Color = raycastResult.Instance.Color
Etc.Material = raycastResult.Material
Etc.Size = Vector3.new(math.random(2,5),math.random(2,5),math.random(2,5))
Etc.Dust.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,raycastResult.Instance.Color),ColorSequenceKeypoint.new(1,raycastResult.Instance.Color)}
task.spawn(function()
while task.wait() do
if Etc:FindFirstChild("Stop") then
break
end
Etc.Dust:Emit(4)
end
end)
task.spawn(function()
while task.wait() do
if Etc:FindFirstChild("StopFloating") then
Position:Destroy()
break
end
if Character.Humanoid.MoveDirection == Vector3.new(0,0,0) then
Position.Position = Character.HumanoidRootPart.Position + Character.HumanoidRootPart.CFrame.LookVector * 4
else
Position.Position = Character.HumanoidRootPart.Position + Character.HumanoidRootPart.CFrame.LookVector * 8
end
end
end)
end
elseif Type == "EarthFire" then
myEvent:FireServer("EarthFire",nil,Item,MouseAim.Hit.p,Item.Color)
elseif Type == "WindSpark" then
Item.Attachment.Spark:Emit(4)
Item.Attachment.Spark1:Emit(20)
elseif Type == "WindLoop" then
task.spawn(function()
while task.wait() do
if Item:FindFirstChild("Stop") then
break
end
if Item:FindFirstChild("A") then
Item.A.Wind1:Emit(2)
Item.A.Wind2:Emit(2)
end
end
end)
elseif Type == "WindFire" then
myEvent:FireServer("WindFire",nil,Item,MouseAim.Hit.p)
end
end)