Help fix buggy custom camera

I want the camera to stop spazzing out whenever i get close to an object…
heres what if currently does: robloxapp-20210919-0347029
the line of code im currently using :

hrp.CFrame =,, hrp.Position.Y, mouse.Hit.Position.Z))

nvm found it just change it into

hrp is the rootpart ofc

local LookingCFrame = CFrame.lookAt(hrp.Position, camera.CFrame:PointToWorldSpace(,0,-100000)))
				hrp.CFrame = CFrame.fromMatrix(hrp.Position, LookingCFrame.XVector, hrp.CFrame.YVector)
1 Like