I came up with a camera Lock On system but had a few issues with it
- Camera will spin if the player gets too close to the target
- Sometimes it acts weird and goes too far from the player
- Not correctly facing the target
Video Example: Camera Video
if input.UserInputType == Enum.UserInputType.MouseButton3 then
if not locked then
local mouse = plr:GetMouse()
if mouse.Target and mouse.Target.Name == "LockOn" then
locked = true
lockevent:FireServer(mouse.Target.Parent)
local LockedTarget = mouse.Target.Parent:FindFirstChild("HumanoidRootPart").Position
local Cam = workspace.CurrentCamera
rs.RenderStepped:Connect(function()
if locked then
uis.MouseBehavior = Enum.MouseBehavior.Default
Cam.CFrame = CFrame.lookAt(Cam.CFrame.Position, LockedTarget) * CFrame.new(3,1,0)
end
end)
end
elseif locked then
locked = false
lockevent:FireServer("N/A")
end
Any help is appreciated