BridgeNet | Insanely optimized, easy-to-use networking library full of utilities, now with roblox-ts! | v1.9.9-beta

Any ETA on when this hotfix is being released?

Tomorrow, or maybe tonight. Sorry for the wait, kind of busy irl.

Okay so I’ve been using this module for quite some time and it has been working fine. Sometimes, it just randomly gives these errors and it just keeps spamming them and all of the bridges stop working.


Any fixes or something that I’ve been doing wrong?

Can you send me a reproduction place so I figure this out?

I figured out what the problem was.
I was firing a bridge inside of a touched event like so:

if hit.Parent:FindFirstChild("Humanoid") then
    Rewind:FireTo(game.Players:GetPlayerFromCharacter(hit.Parent))
end

I had a dummy in my game and when the touched ran on that dummy, the touched event tried to fire the bridge to the player of the respective character but the player didn’t exist hence it started giving the error. I just added a check to see if there is a player for that instance and if there was then I ran the :Fireto.

This fixed the problem. But it would be epic if it didn’t spam the output with an error continuously.
The error can be replicated by trying to fire to a player instance which doesn’t exist through the server like so:

Bridge:FireTo(game.Players:GetPlayerFromCharacter(game.Workspace.Part))
-- spams the error ReplicatedStorage.BridgeNet.ServerBridge:125: table index is nil 

When you try to Fire to another instance then this happens:
(Still spams like crazy)

Bridge:FireTo(game.Workspace.Brick)
-- spams the error FireClient: player argument must be a Player object 

The mistake was being made on my end, but it would be very epic if the error wasn’t spammed and the script didn’t stop working as a whole.
Or maybe something that tells you which line is causing the error to occur

1 Like

Unfortunately I wasn’t able to make the release before leaving. However, you should be able to do game:Get service("ReplicatedStorage"):WaitForChild("RemoteEvent") before doing .Start and it might fix it.

Hello! :Disconnect() is having some trouble rn. If you do disconnect sometimes it will disconnect the wrong connection.
I think I have a fix for this

1 Like

Doesn’t your system not use RemoteEvents?

1 Like

It does use RemoteEvents, however it uses them in a way that takes less data.

Do you think the update will come out by next week?

How is this not working? I followed the documentation and It doesn’t create the ping stats for me:

Client:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Storage = ReplicatedStorage:WaitForChild("Storage")
local Modules = Storage:WaitForChild("Modules")
local BridgeNet = require(Modules:WaitForChild("BridgeNet"))
local CreatePingStats = BridgeNet.CreateBridge("CreatePingStats")

CreatePingStats:Fire()

Server:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Storage = ReplicatedStorage:WaitForChild("Storage")
local Modules = Storage:WaitForChild("Modules")
local BridgeNet = require(Modules:WaitForChild("BridgeNet"))



local CreatePingStats = BridgeNet.CreateBridge("CreatePingStats")


CreatePingStats:Connect(function(player)
	if player:FindFirstChild("leaderstats") then return end
	local PingFolder = Instance.new("Folder")
	PingFolder.Parent = player
	PingFolder.Name = "leaderstats"
	
	local Ping = Instance.new("StringValue")
	Ping.Parent = PingFolder
	Ping.Name = "Ping"
end)

(I start BridgeNet on the client in another script, though this outputs:
“[BridgeNet] waiting for (CreatePingStats) to be replicated to the client”)

It’s likely because this script is running before the starter. Consider using BridgeNet.Started if you are using 1.9.7+ versions.

Or just use single-script architecture.

I tried using BridgeNet.Started, but the remote doesn’t seem to fire. My script is in StarterGui, should I put it in StarterPlayerScripts?

Oh yeah, you should definitely do that because AFAIK you can’t run local scripts within containers like StarterGui.

1 Like

Ok. I did it but the event has a 50 percent chance of firing, sometimes when I join the ping stat loads, other times it does not.

Local scipt that starts Bridge Net on the client:

local ReplicattedStorage = game:GetService("ReplicatedStorage")
local Storage = ReplicattedStorage:WaitForChild("Storage")
local Modules = Storage:WaitForChild("Modules")
local BridgeNet = require(Modules:WaitForChild("BridgeNet"))

BridgeNet.Start({
[BridgeNet.DefaultReceive] = 60,
[BridgeNet.DefaultSend] = 60,
})

Local script which fires the remote:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Storage = ReplicatedStorage:WaitForChild("Storage")
local Modules = Storage:WaitForChild("Modules")
local BridgeNet = require(Modules:WaitForChild("BridgeNet"))
local CreatePingStats = BridgeNet.CreateBridge("CreatePingStats")

BridgeNet.Started:Connect(function()
CreatePingStats:Fire()
end)
1 Like

Switch your script with this:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Storage = ReplicatedStorage:WaitForChild("Storage")
local Modules = Storage:WaitForChild("Modules")

local BridgeNet = require(Modules:WaitForChild("BridgeNet"))
local CreatePingStats = BridgeNet.CreateBridge("CreatePingStats")

if BridgeNet.Started then
	CreatePingStats:Fire()
else
	BridgeNet.Started:Connect(function()
		CreatePingStats:Fire()
	end)
end
2 Likes

Great module, however, I could not find a way of invoking a client. Please let me know if there is a way!

1 Like

This is an anti-pattern. RemoteFunctions: Don't use InvokeClient - YouTube

1 Like

Should I replace every RemoteEvent currently in my game with BridgeNet or is there still some cases where I need to use normal RemoteEvents?

You should be able to replace every RemoteEvent with BridgeNet- it’s more effective the more you use it, actually.

1 Like