local Players = game:GetService("Players") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer local target = { enabled = true, position = nil, } local Hooks = {} local function getClosestTarget() local camera = workspace.Camera local closestDist = math.huge local closestPos = nil for _, part in ipairs(workspace:GetDescendants()) do if part:IsA("BasePart") and part.Name == "HumanoidRootPart" then local model = part.Parent if model and model ~= LocalPlayer.Character then local hum = model:FindFirstChildOfClass("Humanoid") if hum and hum.Health > 0 then local worldPos = part.Position local screenPos, onScreen = camera:WorldToScreenPoint(worldPos) if onScreen then local center = Vector2.new(camera.ViewportSize.X / 2, camera.ViewportSize.Y / 2) local dist = (Vector2.new(screenPos.X, screenPos.Y) - center).Magnitude if dist < closestDist then closestDist = dist closestPos = worldPos end end end end end end return closestPos end RunService.Heartbeat:Connect(function() if target.enabled then local pos = getClosestTarget() if pos then target.position = pos end end end) Hooks.Raycast = hookmetamethod(game, "__namecall", newcclosure(function(self, ...) local args = { ... } local method = getnamecallmethod():lower() local cam = workspace.Camera if target.enabled and target.position and method == "raycast" and self.Name == "Workspace" then local direction = (target.position - cam.CFrame.Position).Unit * 200 args[2] = direction return Hooks.Raycast(self, table.unpack(args)) end return Hooks.Raycast(self, ...) end))