local Players = game:GetService("Players") local ReplicatedFirst = game:GetService("ReplicatedFirst") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera local GeneralFunctions = require(ReplicatedStorage.Modules.GeneralFunctions) local TeamCheck = require(ReplicatedStorage.Modules.TeamCheck) local Bridge = require(ReplicatedFirst.Client.Utility.Bridge) local State = require(ReplicatedFirst.Client.Utility.State) local General = require(ReplicatedFirst.Client.Utility.General) local OriginalCast = GeneralFunctions.cast local OriginalGetHitList = GeneralFunctions.gethitlist local Settings = { SilentAimEnabled = true, AutoFireEnabled = true, InfiniteAmmoEnabled = true, AutoFireMeleeEnabled = false, FieldOfView = 180, IgnoreTeammates = true, RequireVisibility = true, RequireMouseLocked = true, HeadshotRatio = 0.49, MaximumDistance = 1500, MinimumWeaponRange = 20, CameraOriginTolerance = 2, ReserveAmmo = 300, MaximumAmmoGuard = 999, } local previousAssist = getgenv().ArsenalCombatAssist if previousAssist and previousAssist.Restore then previousAssist.Restore() end local previousHook = getgenv().ArsenalRaycastHook if previousHook and previousHook.Restore then previousHook.Restore() end local function IsAlive() return LocalPlayer.NRPBS.Health.Value > 0 end local function HasWeaponEquipped() return State.gun ~= nil and State.equipped ~= "none" end local function IsMouseLocked() local mouseBehavior = UserInputService.MouseBehavior return mouseBehavior == Enum.MouseBehavior.LockCenter or mouseBehavior == Enum.MouseBehavior.LockCurrentPosition end local function IsValidTarget(player) if player == LocalPlayer then return false end local character = player.Character if not character then return false end local humanoid = character:FindFirstChildOfClass("Humanoid") if not humanoid or humanoid.Health <= 0 then return false end if not character:FindFirstChild("Hitbox") then return false end if Settings.IgnoreTeammates and TeamCheck.isteam(LocalPlayer, character) then return false end return true end local function GetAimPoint(hitbox) local verticalOffset = hitbox.Size.Y * Settings.HeadshotRatio return hitbox.Position + Vector3.new(0, verticalOffset, 0) end local function GetAngleBetween(origin, direction, position) local offset = position - origin if offset.Magnitude < 0.001 then return 0 end local dotProduct = direction.Unit:Dot(offset.Unit) return math.acos(math.clamp(dotProduct, -1, 1)) end local function IsVisibleFromCamera(origin, aimPoint, character, hitList) local offset = aimPoint - origin local hitInstance = OriginalCast(Ray.new(origin, offset.Unit * offset.Magnitude), hitList) if hitInstance == nil then return true end return hitInstance:IsDescendantOf(character) end local function FindTarget(origin, direction, hitList) local maximumAngle = math.rad(Settings.FieldOfView) * 0.5 local bestAngle = maximumAngle local bestHitbox = nil local bestAimPoint = nil for _, player in ipairs(Players:GetPlayers()) do if IsValidTarget(player) then local character = player.Character local hitbox = character.Hitbox local aimPoint = GetAimPoint(hitbox) local distance = (aimPoint - origin).Magnitude if distance > 0.001 and distance <= Settings.MaximumDistance then local angle = GetAngleBetween(origin, direction, aimPoint) if angle < bestAngle then if not Settings.RequireVisibility or IsVisibleFromCamera(origin, aimPoint, character, hitList) then bestAngle = angle bestHitbox = hitbox bestAimPoint = aimPoint end end end end end return bestHitbox, bestAimPoint end local function IsWeaponRay(ray) local originOffset = (ray.Origin - Camera.CFrame.Position).Magnitude return originOffset <= Settings.CameraOriginTolerance and ray.Direction.Magnitude >= Settings.MinimumWeaponRange end local function HookedCast(ray, hitList) if Settings.SilentAimEnabled and IsWeaponRay(ray) then local hitbox, aimPoint = FindTarget(ray.Origin, ray.Direction, hitList) if hitbox then return hitbox, aimPoint, Vector3.new(0, 1, 0), hitbox.Material end end return OriginalCast(ray, hitList) end local function MaintainAmmo() if not Settings.InfiniteAmmoEnabled then return end local gun = State.gun if not gun then return end local capacity = math.min(General.getammo(gun), Settings.MaximumAmmoGuard) if State.equipped == "primary" then if State.primarymode == "2" then if State.primarygrenades < 1 then State.primarygrenades = 1 Bridge.CountAmmo:Fire() end if State.storedgrenades < Settings.ReserveAmmo then State.storedgrenades = Settings.ReserveAmmo Bridge.CountAmmo:Fire() end else if State.ammocount < capacity then State.ammocount = capacity Bridge.CountAmmo:Fire() end if State.primarystored < Settings.ReserveAmmo then State.primarystored = Settings.ReserveAmmo Bridge.CountAmmo:Fire() end end elseif State.equipped == "secondary" then if State.ammo2count < capacity then State.ammo2count = capacity Bridge.CountAmmo:Fire() end if State.secondarystored < Settings.ReserveAmmo then State.secondarystored = Settings.ReserveAmmo Bridge.CountAmmo:Fire() end end end local function ShouldAutoFire(hitList) if not Settings.AutoFireEnabled then return false end if not IsAlive() or not HasWeaponEquipped() then return false end if Settings.RequireMouseLocked and not IsMouseLocked() then return false end if State.equipped == "melee" and not Settings.AutoFireMeleeEnabled then return false end if State.reloading or State.equipping or State.taunting then return false end local hitbox = FindTarget(Camera.CFrame.Position, Camera.CFrame.LookVector, hitList) return hitbox ~= nil end GeneralFunctions.cast = newcclosure(HookedCast) local renderConnection = RunService.RenderStepped:Connect(function() MaintainAmmo() local hitList = OriginalGetHitList() local autoFire = ShouldAutoFire(hitList) local playerHolding = UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) if autoFire or playerHolding then State.Held1 = true else State.Held1 = false end end) getgenv().ArsenalCombatAssist = { Settings = Settings, FindTarget = FindTarget, IsWeaponRay = IsWeaponRay, MaintainAmmo = MaintainAmmo, ShouldAutoFire = ShouldAutoFire, OriginalCast = OriginalCast, Restore = function() GeneralFunctions.cast = OriginalCast renderConnection:Disconnect() State.Held1 = false getgenv().ArsenalCombatAssist = nil end, }