local players = game:GetService("Players") local runService = game:GetService("RunService") local userInputService = game:GetService("UserInputService") local localPlayer = players.LocalPlayer local mouse = localPlayer:GetMouse() local camera = workspace.CurrentCamera local isLocked = false local lockedPlayer = nil local function getClosestPlayer() local closestPlayer, shortestDistance = nil, math.huge for _, player in pairs(players:GetPlayers()) do if player ~= localPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then local distance = (player.Character.HumanoidRootPart.Position - localPlayer.Character.HumanoidRootPart.Position).Magnitude if distance < shortestDistance then closestPlayer, shortestDistance = player, distance end end end return closestPlayer end userInputService.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.Q then isLocked = not isLocked if isLocked then lockedPlayer = getClosestPlayer() else lockedPlayer = nil end end end) runService.RenderStepped:Connect(function() if isLocked and lockedPlayer and lockedPlayer.Character and lockedPlayer.Character:FindFirstChild("Head") then camera.CFrame = CFrame.new(camera.CFrame.Position, lockedPlayer.Character.Head.Position) end end) local oldNamecall oldNamecall = hookmetamethod(game, "__namecall", function(self, ...) local args = {...} local method = getnamecallmethod() if method == "FindPartOnRayWithIgnoreList" and not checkcaller() and isLocked and lockedPlayer then if lockedPlayer.Character and lockedPlayer.Character:FindFirstChild("Head") then args[1] = Ray.new(camera.CFrame.Position, (lockedPlayer.Character.Head.Position - camera.CFrame.Position).Unit * 1000) end end return oldNamecall(self, unpack(args)) end)