Hey, I was just wondering if .new has been replaced with the ClientBridge and ServerBridge thing? If so, how does the firing work for it now? Sort of a little confused with the documentation.
Help much appreciated!
Hey, I was just wondering if .new has been replaced with the ClientBridge and ServerBridge thing? If so, how does the firing work for it now? Sort of a little confused with the documentation.
Help much appreciated!
BridgeNet2 has never had a public new
function for ClientBridge or ServerBridge, it’s always been prefixed with an underscore. ReferenceBridge
is how you’re supposed to create bridges, ClientBridge()
and ServerBridge()
are just if you want slightly better typechecking.
I don’t think there were any major breaking changes in 0.4.0
So for clarification, this is the correct usage of creating and connecting an event within Bridgenet2?
local SpellCaster = BridgeNet2.ReferenceBridge(“SpellCaster”)
SpellCaster:Connect(function(…)
end)
Yes, the way you did it is perfectly fine.
You can also do it this way for better type checking like ffrostfall said though:
--//Server code
local SpellCaster = BridgeNet2.ServerBridge("SpellCaster")
SpellCaster:Connect(function(…)
end)
--//Client code
local SpellCaster = BridgeNet2.ClientBridge("SpellCaster")
SpellCaster:Connect(function(…)
end)
Would Player be included in the …
No, that is a separate argument.
0 voters
0 voters
0 voters
How do you use Bridgenet2 in a single tool with a local and server script?
ServerBridge.OnServerInvoke
and ClientBridge:InvokeServer()
.Connected
to connectionsBridge:Wait
.
instead of :
will now errortostring()
-ing a bridge will now return its class typeHi,
I am trying to send multiple data from the server to the client but the array I send only sends the first value, value [1] is always nil.
I am using version v0.5.0
–Server
SoundBridge:Fire(Player, {“20”, “PlaySoundEffect”})
–Client
SoundBridge:Connect(function(values)
print(tostring(values[0])) -- shows 20
print(tostring(values[1])) -- shows nil
end)
Hi,
I got it working by creating the table below, not sure why the above code does not work as well.
SoundBridge:Fire(Player, {[“id”] = “20”, [“sound”] = “PlaySoundEffect”})
It looks like values[0] is nil because Luau arrays start at the index of 1 unlike other languages where it starts at 0.
This issue does not occur in Roblox studio very weird.
I have implemented it both on the client and server.
Any idea what might be causing this issue?
Edit: The issue has been resolved, it was a problem on my end. I thought it might be a bug due to the fact that the error was only displayed on Live Servers.
This module would help me reduce RemoteEvent
issues. Thank you so much!
Good day,
I am having a strange error and I hope someone can help, when I debug my script and it gets to my line below “SoundBridge:Fire(Player, “21”)” it jumps to the ClientBridge script line 57.
I am using the same code in another script and it works, what is the error telling me? the Player value is not nil. The Fire is not sent to the client.
– ClientBridge script
Can you show me where SoundBridge
is declared?
Hello
Using BridgeNet2 I ran into a problem, for some reason I can only join the bridge once if I use the ServerBridge function to create the bridge.
script A
local shooted = BridgeNet2.ServerBridge("shooted")
local function onAimStopped(player: Player)
print("a")
--smth
end
shooted:Connect(onAimStopped)
script A prints “a” when client fires this event, as expected
script B
local shooted = BridgeNet2.ServerBridge("shooted")
shooted:Connect(function(player: Player, args: {})
print("b")
--smth
end)
but script B doesn’t print anything
The same bridge is used in two different places, and in both cases the ServerBridge method is called, then the scripts connects to the bridge, but the signal only fires in the one who connected to the bridge faster. And if you replace the SeverBridge method with ReferenceBridge, then everything works fine.
script A and B is used for example, if needed i can show the source code
I’ll look into this issue, can you send me a reproduction place file in DMs?