So i was trying to make Over-the-Shoulder type of camera and lerp it to feel the speed of the character, but after i added lerping camera started to jitter and i idk how to fix this. I have already tried many diff ways but nothing seems to help.
Code:
local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera
local CameraPart = Instance.new("Part", workspace)
CameraPart.Size = Vector3.new(0.5, 0.5, 0.5)
CameraPart.Transparency = 1
CameraPart.CanCollide = false
CameraPart.Anchored = true
CameraPart.Name = "CameraPart"
Camera.CameraSubject = CameraPart
Camera.CameraType = Enum.CameraType.Custom
RunService.Heartbeat:Connect(function(dt)
Camera.CameraSubject = CameraPart
local Character = game.Players.LocalPlayer.Character
if not Character then return end
local Humanoid = Character:FindFirstChild("Humanoid")
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
if not Humanoid or not HumanoidRootPart then return end
CameraPart.CFrame = CameraPart.CFrame:Lerp(CFrame.new(HumanoidRootPart.Position + Camera.CFrame.RightVector*2 + Vector3.new(0, 1.5, 0)),
10*dt)
end)