Camera manipulation causing network lag?

I’m working on an FPS, I’ve created camera bobbing and recoil, but for some reason this is causing network lag for OTHER players?

In a studio test with 2 players (happens in live games as well) if I spam WASD on one player, the other player will receive about 25kb/s. Stops once movement ends.

image

This is really weird, because there’s really nothing happening on the server to characters. No gun models, animations, etc. it’s just a couple attributes on the character.

I’ve tracked it down to this line (running on RenderStepped) Of course this is a local script. Commenting this line out completely stops the issue (goes back to normal kb/s recv on movement)

workspace.CurrentCamera.CFrame = CFrame.new(NewCamFrame.Position) * CFrame.fromOrientation(math.rad(ClampX), rY, rZ)

This is basically applying a bobble + recoil spring to the camera, it works great. But for some reason it’s the cause of the network lag.

My only idea is because we’re in first person, updating the camera also updates the character, so the character is also being affected by the recoil+bobble, but then disabling AutoRotate on the Humanoid changes nothing so I don’t think that’s the cause?

Does anybody know why this would be happening, and how to fix it while keeping recoil+bobble?

Do you have another script somewhere that’s broadcasting camera changes to other clients? Maybe a look direction script?

I do, I’m sending the camera’s Y angle to the server and then other clients. However this is only fired at intervals, not on change. If this was the problem it would be constant, not only when recoil+bobbing happen.

I’m not actually doing anything with the Y angle on the server other then send it to other clients, so it’s not manipulating the character (and causing the lag)

I used this plugin to see incoming remotes, and it confirms the issue is not from this, or any other remotes.

Still having this issue, this is the code running every frame that edits the camera

		local UpdatedRecoil = RecoilSpring:update(dt)
		local UpdatedBobble = BobbleSpring:update(dt)
		local UpdatedSway = SwaySpring:update(dt)
		
		local NewCamFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(math.rad(UpdatedRecoil.X), math.rad(UpdatedRecoil.Y), math.rad(UpdatedRecoil.Z))
		NewCamFrame *= CFrame.Angles(math.rad(UpdatedBobble.X), math.rad(UpdatedBobble.Y), 0)
		local rX, rY, rZ = NewCamFrame:ToOrientation()
		local ClampX = math.clamp(math.deg(rX), -80, 80)
		workspace.Camera.CFrame = CFrame.new(NewCamFrame.Position) * CFrame.fromOrientation(math.rad(ClampX), rY, rZ)