I found a script which I edited a little to work for what I need, and it basically adds a delay to the camera movement and adds rotation o the camera when the player looks around. This is what the script looks like:
local MaxRot = 80
local Character = script.Parent
local X,Y = 0,0
repeat wait(0.1) until Character.Head
game:GetService("RunService").RenderStepped:Connect(function()
for _, v in pairs(Character:GetDescendants()) do if v:IsA('BasePart') or v:IsA("MeshPart") then
v.LocalTransparencyModifier = 1
end
end
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game:GetService('UserInputService').MouseBehavior = Enum.MouseBehavior.LockCenter
local Tick = tick()
local MouseDelta = game:GetService('UserInputService'):GetMouseDelta()
local DeltaX = math.rad((MouseDelta.X * 1.9)*(1.4*2.1))
local DeltaY = math.rad((MouseDelta.Y * 1.9)*(1.4*2.1))
X = X - math.rad(DeltaX)
Y = math.min(math.max(Y - math.rad(DeltaY), math.rad(-MaxRot)), math.rad(MaxRot))
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame:Lerp( CFrame.new(Character.Head.CFrame.Position) * CFrame.Angles(0, X, 0) * CFrame.Angles(Y,0,0),.5)
end)
This works just fine, however when I made character parts visible or added it to a viewmodel, this is what happens
There is a very noticeable jitter when moving in any direction.
I saw somewhere that Enum.RenderPriority.Camera.Value + 1 would somehow help this, but I don’t know where I can put this into the script. I also tried to bind it to renderstepped, but this was a mistake because it was then just updating to the framerate and causing immense frame drops.