so this code i made is supposed to follow the character model smoothly.
but it looks kinda choppy
local posPrev=Vector3.zero
game:GetService("RunService").Stepped:Connect(function()
workspace.CurrentCamera.CameraType=Enum.CameraType.Scriptable
local character:Model=nil
for _,i in pairs(workspace.characters:GetChildren()) do
if i:GetAttribute("ownerID")==tostring(game.Players.LocalPlayer.UserId) then
character=i
end
end
if character==nil then
return
end
local dist=character:GetAttribute("viewDistance") --this attribute determines how far player can see
posPrev+=(character.PrimaryPart.Position-posPrev)/10
if character then
workspace.CurrentCamera.CFrame=CFrame.lookAt(posPrev+Vector3.new(0,10,-5)*dist,character:GetPivot().Position)
end
end)