-- Configuration table local Config = { SmoothTransition = true, PriorityLowHealth = true, UseFOVCheck = true, -- {Expiremental} AdjustableDistance = true, WallCheck = true, DynamicZoom = true, CameraShakeOnHit = true, LockMultipleTargets = true, -- {Expiremental} MaxTargets = 3, -- Maximum number of targets to lock onto CombatStateToggle = false, LockDistance = 100, HighlightTarget = true, -- {Expiremental} FleeMode = false, -- {Expiremental} KeybindToggle = Enum.KeyCode.L, -- Keybind For Camlock } local Players = game:GetService("Players") local RunService = game:GetService("RunService") local Camera = workspace.CurrentCamera local LocalPlayer = Players.LocalPlayer local UserInputService = game:GetService("UserInputService") local locked = false local currentTargets = {} -- Based On Config local function getMultipleTargets() local selectedTargets = {} for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Team ~= LocalPlayer.Team then local character = player.Character if character and character:FindFirstChild("Head") and character:FindFirstChild("Humanoid") then local distance = (character.Head.Position - Camera.CFrame.Position).Magnitude if Config.UseFOVCheck then local direction = (character.Head.Position - Camera.CFrame.Position).Unit local angle = math.acos(Camera.CFrame.LookVector:Dot(direction)) if math.deg(angle) > 45 then -- FOV limit of 45 degrees continue end end if Config.AdjustableDistance and distance > Config.LockDistance then continue end table.insert(selectedTargets, { player = player, distance = distance }) end end end table.sort(selectedTargets, function(a, b) return a.distance < b.distance end) -- Max Players local finalTargets = {} for i = 1, math.min(#selectedTargets, Config.MaxTargets) do table.insert(finalTargets, selectedTargets[i].player) end return finalTargets end local function isTargetVisible(target) local origin = Camera.CFrame.Position local targetPosition = target.Character.Head.Position local ray = Ray.new(origin, (targetPosition - origin).Unit * Config.LockDistance) local hitPart = workspace:FindPartOnRay(ray, LocalPlayer.Character) return hitPart and hitPart:IsDescendantOf(target.Character) end local function lockCameraToTarget(targets) if not targets or #targets == 0 then return end for _, target in pairs(targets) do if target and target.Character and target.Character:FindFirstChild("Head") then local headPosition = target.Character.Head.Position local direction = (headPosition - Camera.CFrame.Position).Unit if Config.SmoothTransition then local currentCFrame = Camera.CFrame local targetCFrame = CFrame.new(Camera.CFrame.Position, headPosition) Camera.CFrame = currentCFrame:Lerp(targetCFrame, 0.1) else Camera.CFrame = CFrame.new(Camera.CFrame.Position, headPosition) end if Config.DynamicZoom then local distance = (headPosition - Camera.CFrame.Position).Magnitude Camera.FieldOfView = math.clamp(70 - (distance / 10), 40, 70) end end end end local function toggleLock() locked = not locked if not locked then currentTargets = {} Camera.FieldOfView = 70 -- Reset FOV end end -- Keybind toggling for Camlock ( "Idk why but this stumped me for a bit :(" ) UserInputService.InputBegan:Connect(function(input) if input.KeyCode == Config.KeybindToggle then toggleLock() end end) RunService.RenderStepped:Connect(function() if locked then local targets = getMultipleTargets() if #targets > 0 and (not Config.WallCheck or isTargetVisible(targets[1])) then currentTargets = targets lockCameraToTarget(currentTargets) end end end)