Hi ^
Lucky me to have stumbled upon this at the exact right time. I am trying to rotate character’s waist by sending a value from local script to server and then doing the rotation on the server itself. This works fine, but since I’m using remote events, with many clients it will lag like hell, so I want to use your module.
But since the documentation doesn’t provide some necessary information, I hope you can help me figure this out ^
Here’s how it works without BridgeNet
Client:
function updatewaist(dt)
local cameralookvectorY = workspace.CurrentCamera.CFrame.lookVector.Y
local radian = math.asin(cameralookvectorY)
if camMove.Value == true then
repEvent:FireServer(waist, c0*CFrame.fromEulerAnglesYXZ(radian,0,0))
end
end
runService.Heartbeat:Connect(updatewaist)
Server:
replicateEvent.OnServerEvent:Connect(function(sender, waist, rot)
waist.C0 = rot
end)
Now questions about implementing bridgenet into this.
-
It says in the documentation that BridgeNet.Start needs to be called only once for server and client. Does this mean that I need to call BridgeNet.Start only in one server script, and it will work for all the others? And also create it just once for each client, or just create it on the server, and I can use it on the client too without creating?
-
BridgeNet.CreateBridge(). It says that it creates either a client bridge, or a server bridge, depending on where it’s called. So for example in my case, do I need to just call CreateBridge() on client, and then use Fire() without creating anything on the server? So how would I connect to these bridge on the server.
If you could provide some simple example code of firing a remoteevent to server and then doing something on the server,it would be very helpful. And Thank You for very useful module! If not this I would’ve left my game unfinished, since what I’m trying to achieve is a very important aspect of it (Melee Combat System), and Roblox itself doesn’t provide many tools for ping optimization.