I would like to know why it jitters like this. I have a testing place that has the same scripts same gun same everything but its smooth when aiming. Only difference between the test place and the actual game itself is that there is more going on such as part count. I have already tried :BindToRenderedStep and .PreRender but haven’t noticed any difference. The way aiming works is that the CFrame is lerped to the aimPart found in the viewModel.
if rightMouseDown then
gunIdleAnim:Stop()
if currentGun:FindFirstChild("Scope") then
aimingCF = aimingCF:Lerp(currentGun.Scope.Scope.AimPart.CFrame:ToObjectSpace(currentGun.PrimaryPart.CFrame), .1)
if workspace.CurrentCamera.FieldOfView > 5 then
local clampedAim = math.clamp( workspace.CurrentCamera.FieldOfView - 2, 5, 70)
workspace.CurrentCamera.FieldOfView = clampedAim
end
else
aimingCF = aimingCF:Lerp(currentGun.Gun.AimPart.CFrame:ToObjectSpace(currentGun.PrimaryPart.CFrame), .1)
if workspace.CurrentCamera.FieldOfView > 50 then
local clampedAim = math.clamp( workspace.CurrentCamera.FieldOfView - .5, 50, 70)
workspace.CurrentCamera.FieldOfView = clampedAim
end
end
uis.MouseDeltaSensitivity = 0.2
if keys.Shift then
gunSwayAnim:Stop()
elseif not gunSwayAnim.IsPlaying then
gunSwayAnim:Play()
end
else
uis.MouseDeltaSensitivity = 1
gunSwayAnim:Stop()
if not gunIdleAnim.IsPlaying then
gunIdleAnim:Play()
end
if workspace.CurrentCamera.FieldOfView < 70 then
local clampedUnAim = math.clamp( workspace.CurrentCamera.FieldOfView + 1, 0, 70)
workspace.CurrentCamera.FieldOfView = clampedUnAim
end
aimingCF = aimingCF:Lerp(CFrame.new(), .1)
end