-- ModuleScript TargetSelector (via decompile) local Workspace_upv_1 = game:GetService("Workspace") local CollectionService_upv_1 = game:GetService("CollectionService") local Players_upv_1 = game:GetService("Players") local AimAssistEnum_upv_1 = require(script.Parent.AimAssistEnum) local LocalPlayer_upv_1 = Players_upv_1.LocalPlayer local tbl_upv_1 = {} tbl_upv_1.__index = tbl_upv_1 local function getCenterPoint(a1) --[[ name: getCenterPoint line: 62 ]] if a1:IsA("Model") then return a1:GetBoundingBox().Position end if a1:IsA("BasePart") then return a1.ExtentsCFrame.Position end warn((("Instance %* is not a Model or BasePart"):format(a1.Name))) return a1:GetPivot().Position end function tbl_upv_1._checkLineOfSight(a1, a2, a3, a4) --[[ name: _checkLineOfSight line: 74 upvalues: LocalPlayer_upv_1 (copy, index: 1) Workspace_upv_1 (copy, index: 2) ]] local v1 = RaycastParams.new() v1.FilterType = Enum.RaycastFilterType.Exclude v1.FilterDescendantsInstances = {a2, a3} if LocalPlayer_upv_1 and LocalPlayer_upv_1.Character then v1:AddToFilter({LocalPlayer_upv_1.Character}) end local v2 = Workspace_upv_1:Raycast(a2:GetPivot().Position, a4, v1) == nil return v2 end function tbl_upv_1._checkPointHit(a1, a2, a3, a4, a5) --[[ name: _checkPointHit line: 90 ]] local v3 = a2:GetPivot() local Position_1 = v3.Position local v4 if (a5) and (a5.Magnitude > 0.01) then v4 = a5.Unit else v4 = v3.LookVector end local v5 = a4 - Position_1 local Magnitude_1 = v5.Magnitude local v6 = math.deg(math.acos(math.clamp(v4:Dot(v5.Unit), -1, 1))) local v7 = (Magnitude_1 <= a1.range) and (v6 <= a1.fieldOfView / 2) if v7 then v7 = (a1.ignoreLineOfSight) or a1:_checkLineOfSight(a2, a3, v5) end local tbl_2 = {} tbl_2.hit = v7 tbl_2.angle = v6 tbl_2.distance = Magnitude_1 return tbl_2 end function tbl_upv_1._getTargetPoints(a1, a2, a3) --[[ name: _getTargetPoints line: 118 upvalues: getCenterPoint (copy, index: 1) CollectionService_upv_1 (copy, index: 2) ]] if a3 then local tbl_3 = {} for _, value_1 in a3 do for v1, value_2 in a2:GetDescendants() do if not (value_2:IsA("PVInstance")) then continue end if CollectionService_upv_1:HasTag(value_2, value_1) then table.insert(tbl_3, (getCenterPoint(value_2))) end end end return tbl_3 else local tbl_4 = {getCenterPoint(a2)} return tbl_4 end end function tbl_upv_1.setRange(a1, a2) --[[ name: setRange line: 141 ]] a1.range = a2 end function tbl_upv_1.setFieldOfView(a1, a2) --[[ name: setFieldOfView line: 145 ]] a1.fieldOfView = a2 end function tbl_upv_1.setSortingBehavior(a1, a2) --[[ name: setSortingBehavior line: 149 ]] a1.sortingBehavior = a2 end function tbl_upv_1.setIgnoreLineOfSight(a1, a2) --[[ name: setIgnoreLineOfSight line: 153 ]] a1.ignoreLineOfSight = a2 end function tbl_upv_1.addTargetTag(a1, a2, a3) --[[ name: addTargetTag line: 157 ]] a1.tags[a2] = true a1.tagBones[a2] = a3 end function tbl_upv_1.removeTargetTag(a1, a2) --[[ name: removeTargetTag line: 162 ]] a1.tags[a2] = nil a1.tagBones[a2] = nil end function tbl_upv_1.addPlayerTargets(a1, a2, a3, a4) --[[ name: addPlayerTargets line: 167 ]] a1.targetPlayers = true local v8 if a2 == nil then v8 = true else v8 = a2 end a1.ignoreLocalPlayer = v8 if a3 == nil then v8 = false else v8 = a3 end a1.ignoreTeammates = v8 a1.playerBones = a4 end function tbl_upv_1.removePlayerTargets(a1) --[[ name: removePlayerTargets line: 174 ]] a1.targetPlayers = false end local function onSameTeam(a1, a2) --[[ name: onSameTeam line: 35 ]] local Data_1 = a1:FindFirstChild("Data") local Data_2 = a2:FindFirstChild("Data") local _ = Data_1 and (Data_1:FindFirstChild("TeamDamage")) local v1 = Data_2 and (Data_2:FindFirstChild("TeamDamage")) local Character_1 = a2.Character local v2 = Character_1 and (Character_1:FindFirstChildOfClass("Humanoid")) if Data_1 and Data_2 then if not (Data_1.Value) and not (Data_2.Value) then if Character_1 and (Character_1:FindFirstChildOfClass("ForceField") or Character_1 and Character_1.Sit) then return true end return false end return true elseif Character_1 and (Character_1:FindFirstChildOfClass("ForceField") or Character_1 and Character_1.Sit) then return true else return false end end function tbl_upv_1.getAllTargetPoints(a1) --[[ name: getAllTargetPoints line: 179 upvalues: CollectionService_upv_1 (copy, index: 1) LocalPlayer_upv_1 (copy, index: 2) Players_upv_1 (copy, index: 3) onSameTeam (copy, index: 4) ]] local tbl_5 = {} local v9 = nil for key_1, _ in a1.tags do local v10 = CollectionService_upv_1:GetTagged(key_1) local v11 = a1.tagBones[key_1] for v14, value_3 in v10 do if not (value_3) or not (value_3:IsA("PVInstance")) then continue end v9 = value_3:FindFirstChild("Health") or (value_3:GetAttribute("Health")) local v12 = v9:IsA("IntValue") if v12 then v9 = v9.Value end if not (v9) or not (v9 <= 0) then table.insert(tbl_5, {instance = value_3, points = a1:_getTargetPoints(value_3, v11)}) end end end if LocalPlayer_upv_1 and a1.targetPlayers then local playerBones_1 = a1.playerBones for _, value_4 in Players_upv_1:GetPlayers() do if (not (a1.ignoreLocalPlayer) or value_4 ~= LocalPlayer_upv_1) and (not (a1.ignoreTeammates) or not (onSameTeam(value_4, LocalPlayer_upv_1))) then if not (value_4.Character) then continue end local v13 = value_4.Character:FindFirstChildOfClass("Humanoid") if not (v13) then continue end if not (v13.Health < 25) then table.insert(tbl_5, {instance = value_4.Character, points = a1:_getTargetPoints(value_4.Character, playerBones_1)}) end end end end return tbl_5 end function tbl_upv_1.selectTarget(a1, a2, a3) --[[ name: selectTarget line: 237 upvalues: AimAssistEnum_upv_1 (copy, index: 1) ]] local tbl_6 = {bestPosition = Vector3.new(0, 0, 0), normalizedAngle = 0, angle = 0, normalizedDistance = 0, distance = 0} tbl_6.positions = {} tbl_6.weights = {} local v14 = math.huge local v15 = nil local v16 = nil for _, value_5 in a1:getAllTargetPoints() do local instance_1 = value_5.instance local points_1 = value_5.points for v20, value_6 in points_1 do v16 = a1:_checkPointHit(a2, instance_1, value_6, a3) if not (v16.hit) then continue end v15 = nil if a1.sortingBehavior == AimAssistEnum_upv_1.AimAssistSortingBehavior.Angle then v15 = v16.angle elseif a1.sortingBehavior == AimAssistEnum_upv_1.AimAssistSortingBehavior.Distance then v15 = v16.distance end if not (v15) then continue end if v15 < v14 then tbl_6.distance = v16.distance tbl_6.angle = v16.angle tbl_6.instance = instance_1 tbl_6.bestPosition = value_6 tbl_6.positions = points_1 v14 = v15 end end end if not tbl_6.instance then return nil end local tbl_7 = {} local v17 = 0 local v18 = nil for key_2, value_7 in tbl_6.positions do local v19 = a1:_checkPointHit(a2, tbl_6.instance, value_7, a3) v18 = 0 if not (v19.hit) then v17 = v17 + v18 tbl_7[key_2] = v18 continue end if a1.sortingBehavior == AimAssistEnum_upv_1.AimAssistSortingBehavior.Angle then v18 = 1 / (v19.angle + 0.001) v17 = v17 + v18 tbl_7[key_2] = v18 continue end if a1.sortingBehavior == AimAssistEnum_upv_1.AimAssistSortingBehavior.Distance then v18 = 1 / (v19.distance + 0.001) end v17 = v17 + v18 tbl_7[key_2] = v18 end if v17 > 0 then for n_1 = 1, #tbl_7 do tbl_7[n_1] = tbl_7[n_1] / v17 end end tbl_6.weights = tbl_7 tbl_6.normalizedDistance = tbl_6.distance / a1.range tbl_6.normalizedAngle = (tbl_6.angle / a1.fieldOfView) * 2 return tbl_6 end function tbl_upv_1.new() --[[ name: new line: 320 upvalues: AimAssistEnum_upv_1 (copy, index: 1) tbl_upv_1 (copy, index: 2) ]] local tbl_8 = {fieldOfView = 20, range = 100, targetPlayers = true, ignoreLocalPlayer = true, ignoreTeammates = false, ignoreLineOfSight = false} tbl_8.sortingBehavior = AimAssistEnum_upv_1.AimAssistSortingBehavior.Angle tbl_8.playerBones = {} tbl_8.tags = {} tbl_8.tagBones = {} setmetatable(tbl_8, tbl_upv_1) return tbl_8 end return tbl_upv_1