Lagging and Ping Increase when zoomed in to first person

Yeah, so as the title says, when I or someone else goes into first-person, they experience large amounts of lag, making my shooter game unplayable.

I eliminated scripts that were lagging things up but it didn’t seem to help.

Again, this is strictly when I zoom in my camera, when I zoom out everything runs at the perfect 60 frames per second.

Another detail, I notice that my ping goes from 90 to 110+ when I go into first-person view.

EDIT: It goes up to 180, the way I seem to be able to fix it is resetting, implying that it gets worse over time. Other people also report that it gets worse over time.

MicroProfiler maxes out.
No scripts seem to pop out as damaging when zoomed in.
MicroProfiler says that “things” in the Render group can go up to 6 seconds.

Any help?

1 Like

I tripped across this while trying to figure out why my game was running great when looking straight ahead but lagged when looking around. I have a complex world with a lot of meshes and scripts, but something in the Render group of the MicroProfiler was taking a long time. I figured out that I had meshes and a script attached to the camera and when looking to the side (to the side of the mesh) I was getting lag. I figured out that the mesh and script were being rendered and processed when I was looking at them, so I put this into a script attached to the camera:
local camOb = script.Parent
local cam = script.Parent.CurrentCamera
local camLastPos = cam.CFrame
local camPos = cam.CFrame
local camObLastPos = camOb.CFrame
local camObPos = camOb.CFrame

function camUpdate(cam,camLastPos,camPos)
    camPos = cam.CFrame
    if camPos == camLastPos then
        cam.TextTransparency = 1
        cam.RotateTransparency = 1
    else
        cam.TextTransparency = 0
        cam.RotateTransparency = 0
    end
    camLastPos = cam.CFrame
end
while true do
    camUpdate(cam,camLastPos,camPos)
    wait(.1)
end
This script has the effect of making anything attached to the camera (in this case, a mesh and a script) completely invisible to anything that might be rendering or processing it. In my case, the mesh is a full-screen grid (for use in a CAD program) and the script is a script that measures distances from the camera to things. The effect is that when I'm looking straight ahead, the grid and the script are invisible, but when I turn to the side, they are visible. This is a bit counter-intuitive but that is how the script works. It does the job of making sure attached objects are not rendered or processed when not needed.
1 Like

Thanks for the detailed response.

When I did a diagnosis, it turns out the main reason for lag was a while wait() loop constantly setting LocalTransparencyModifier.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.