A while back I actually found problem, but i forgot about the topic, But You need to Use springs, First create, Attachment for the character, and for target object, Make sure Coils are Zero and damping. Make sure LimitEnabled is True, make sure the MaxLength is somewhere between a good spot where the camera won’t go up. I have myes on 2.5. make sure you use MinLength, because if your MinLength is low, the spring will pull you towards the target.
Also thanks for replying @Moonvane
Here the script if you want it.
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Part = Instance.new("Part")
Part.Name = "CameraLockOn"
Part.Size = Vector3.new(1,1,1)
Part.CanCollide = false
Part.Parent = workspace.CurrentCamera
local BodyPosition = Instance.new("BodyPosition")
BodyPosition.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BodyPosition.D = 500
BodyPosition.Parent = Part
local LocalPlayer = Players.LocalPlayer or Players.PlayerAdded:Wait()
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Target = workspace.Dummy
local CharacterAttacmentSpring = Instance.new("Attachment")
CharacterAttacmentSpring.Name = "LockOnAttacment"
CharacterAttacmentSpring.Parent = Character.PrimaryPart
local NPCAttacment = Instance.new("Attachment")
NPCAttacment.Name = "NPCAttacment"
NPCAttacment.Parent = Target.HumanoidRootPart
local LockOnSpringConstraint = Instance.new("SpringConstraint")
LockOnSpringConstraint.Name = "LockOnSpringConstraint"
LockOnSpringConstraint.Attachment0 = CharacterAttacmentSpring
LockOnSpringConstraint.Attachment1 = NPCAttacment
LockOnSpringConstraint.Enabled = true
LockOnSpringConstraint.Visible = true
LockOnSpringConstraint.Coils = 0
LockOnSpringConstraint.Damping = 0
LockOnSpringConstraint.LimitsEnabled = true
LockOnSpringConstraint.MinLength = 1000
LockOnSpringConstraint.MaxLength = 2.5
LockOnSpringConstraint.Parent = Character
RunService.RenderStepped:Connect(function()
local CameraPostion = CFrame.new(Character.HumanoidRootPart.Position,
Target.PrimaryPart.Position) * CFrame.new(0,4,10).p
BodyPosition.Position = CameraPostion
workspace.CurrentCamera.CFrame = CFrame.new(Part.Position, Target.PrimaryPart.Position)
end)