getgenv().AimTarget = "Both" -- Options: "Bot", "Player", "Both" getgenv().AimWallbang = false local Players = game:GetService("Players") local LocalPlayer = game:GetService("Players").LocalPlayer local Workspace = workspace local Camera = Workspace.CurrentCamera local function isTargetVisible(cameraPos, targetPos, ignoreList) local direction = (targetPos - cameraPos) local distance = direction.Magnitude if distance <= 0 then return true end direction = direction.Unit local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Blacklist params.FilterDescendantsInstances = ignoreList params.IgnoreWater = true local rayResult = Workspace:Raycast(cameraPos, direction * (distance + 0.5), params) if rayResult == nil then return true end local hitInstance = rayResult.Instance if math.abs(rayResult.Distance - distance) < 1 then return true end local current = hitInstance while current do if current:IsA("Model") and current:FindFirstChild("HumanoidRootPart") then return true end current = current.Parent end return false end local function getBestTarget() local character = LocalPlayer.Character if not character then return {} end local primaryPart = character.PrimaryPart if not primaryPart then return {} end local cameraPos = Camera.CFrame.Position local screenCenter = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2) local ignoreList = {character} for _, child in ipairs(character:GetChildren()) do if child:IsA("Tool") then table.insert(ignoreList, child) end end local allTargets = {} local function addTarget(charModel, hrp, isVisible) table.insert(allTargets, { character = charModel, hrp = hrp, isVisible = isVisible }) end if getgenv().AimTarget == "Bot" or getgenv().AimTarget == "Both" then local missionsFolder = Workspace:FindFirstChild("Missions") if missionsFolder then for _, mission in ipairs(missionsFolder:GetChildren()) do local aiSpawners = mission:FindFirstChild("AISpawners") if aiSpawners then for _, spawner in ipairs(aiSpawners:GetChildren()) do local botModel = spawner:FindFirstChildWhichIsA("Model") if botModel then local humanoid = botModel:FindFirstChildOfClass("Humanoid") local hrp = botModel:FindFirstChild("HumanoidRootPart") if humanoid and hrp and humanoid.Health > 0 then local visible = isTargetVisible(cameraPos, hrp.Position, ignoreList) if visible then addTarget(botModel, hrp, true) elseif getgenv().AimWallbang then addTarget(botModel, hrp, false) end end end end end end end end if getgenv().AimTarget == "Player" or getgenv().AimTarget == "Both" then for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer then local targetChar = player.Character if targetChar then local humanoid = targetChar:FindFirstChildOfClass("Humanoid") local hrp = targetChar:FindFirstChild("HumanoidRootPart") if humanoid and hrp and humanoid.Health > 0 then table.insert(ignoreList, targetChar) local visible = isTargetVisible(cameraPos, hrp.Position, ignoreList) if visible then addTarget(targetChar, hrp, true) elseif getgenv().AimWallbang then addTarget(targetChar, hrp, false) end end end end end end local targetsWithDist = {} for _, target in ipairs(allTargets) do local screenPos, onScreen = Camera:WorldToScreenPoint(target.hrp.Position) if onScreen then target.screenDist = (Vector2.new(screenPos.X, screenPos.Y) - screenCenter).Magnitude table.insert(targetsWithDist, target) end end table.sort(targetsWithDist, function(a, b) if a.isVisible ~= b.isVisible then return a.isVisible end return a.screenDist < b.screenDist end) local result = {} for _, target in ipairs(targetsWithDist) do table.insert(result, target.character) end return result end local RaycastModule = require(game:GetService("ReplicatedStorage").Modules.Tool.Gun.Raycast) local GetMouseHitModule = require(game:GetService("ReplicatedStorage").Modules.Tool.Raw.GetMouseHit) pcall(restorefunction, RaycastModule.FireRay) pcall(restorefunction, GetMouseHitModule) local FireRay; FireRay = hookfunction(RaycastModule.FireRay, function(p1, p2, p3, p4, p5, p6, p7, p8) local bestTargets = getBestTarget() if #bestTargets > 0 then local v1, v2, v3, v4 local target = bestTargets v1 = {target[1].HumanoidRootPart.Position} v2 = {} v3 = {} for _,v in ipairs(target) do table.insert(v2, { v, target[1].HumanoidRootPart.Position, (target[1].HumanoidRootPart.Position-game:GetService("Players").LocalPlayer.Character.PrimaryPart.Position).Unit, "Humanoid" }) table.insert(v3, v.Humanoid) end v4 = {} return v1, v2, v3, v4 else return FireRay(p1, p2, p3, p4, p5, p6, p7, p8) end end) local GetMouseHit; GetMouseHit = hookfunction(GetMouseHitModule, function(p1) local bestTargets = getBestTarget() if #bestTargets > 0 then return bestTargets[1].HumanoidRootPart.Position else return GetMouseHit(p1) end end)