I’m having some issues with the lock-on system I am currently using, and I have been searching for hours to find a solution to this.
I found this post but the solution did not work for me:
https://devforum.roblox.com/t/lock-on-camera-glitches-when-target-is-too-close/555079
The lock-on works fine, but the camera spins everywhere when I get close to the target.
https://i.gyazo.com/28e2893aebe36ea088a103272bc5170b.mp4
This is my code:
game:GetService("RunService").RenderStepped:Connect(function()
local B = Target.HumanoidRootPart.Position
local A = c.HumanoidRootPart.Position
local Offset = Vector3.new(-3, 2, 6.5)
local V = B + ((A + Offset) - B).Unit * ((A - B).Magnitude + 10.25)
local CamPos = CFrame.new(V, B).Position
Camera.CameraType = "Scriptable"
Camera.CFrame = CFrame.new(CamPos, Target.HumanoidRootPart.Position)
Camera.CFrame = CFrame.new(Camera.CFrame.Position, Target.HumanoidRootPart.Position)
end)