AIM ESP NO BAN TP KILL ALL SOURCE CODE
Key Required

AIM ESP NO BAN TP KILL ALL SOURCE CODE

Warfareleetleet 9.3K views 1.5K executesUpdated Dec 18, 2025
3.3/ 5(3 votes)
2167% Positive
Lua Script•1969 lines (65373 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local TweenService = game:GetService("TweenService")

local LocalPlayer = Players.LocalPlayer
local Camera = Workspace.CurrentCamera

local Config = {
    ESP_Enabled = true,
    ESP_Box = true,
    ESP_Name = true,
    ESP_Health = true,
    ESP_Distance = true,
    ESP_TeamCheck = true,
    ESP_MaxDistance = 800,
    ESP_HideSpawn = true,
    ESP_SpawnY = -20,
    
    DRONE_ESP = true,
    DRONE_MaxDistance = 500,
    
    CHAMS_Enabled = true,
    CHAMS_FillTransparency = 0.7,
    CHAMS_OutlineTransparency = 0,
    
    AIM_Enabled = true,
    AIM_FOV = 150,
    AIM_Smooth = 0.12,
    AIM_TeamCheck = true,
    AIM_TargetPart = "Head",
    AIM_Key = Enum.UserInputType.MouseButton2,
    AIM_ShowFOV = true,
    AIM_Prediction = true,
    AIM_PredictionAmount = 1.0,
    
    RECOIL_Enabled = true,
    RECOIL_Strength = 1.0,
    
    NO_CAMSHAKE = true,
    NO_GUNBOB = true,
    
    TP_Enabled = true,
    TP_Key = Enum.KeyCode.T,
    TP_Distance = 5,
    TP_AutoShoot = true,
    
    MenuOpen = true,
    MenuKey = Enum.KeyCode.Insert
}

local RecoilProfiles = {
    ["AK"] = {
        kickStrength = 0.055, horizontalStrength = 0.05, gunRise = 0.02, cameraShake = 0.04,
        horizontalRandomness = 0.1, kickRandomness = 0.15, crouchMultiplier = 0.72, aimMultiplier = 0.35,
        sprayIncrease = 0.12, returnSpeed = 0.1, patternScale = 0.045, firstShotMultiplier = 0.75,
        moveMultiplier = 1.35, rpm = 600
    },
    ["M4A1"] = {
        kickStrength = 0.035, horizontalStrength = 0.05, gunRise = 0.015, cameraShake = 0.04,
        horizontalRandomness = 0.1, kickRandomness = 0.15, crouchMultiplier = 0.72, aimMultiplier = 0.35,
        sprayIncrease = 0.12, returnSpeed = 0.1, patternScale = 0.045, firstShotMultiplier = 0.75,
        moveMultiplier = 1.35, rpm = 800
    },
    ["SVD"] = {
        kickStrength = 0.07, horizontalStrength = 0.07, gunRise = 0.02, cameraShake = 0.055,
        horizontalRandomness = 0.14, kickRandomness = 0.18, crouchMultiplier = 0.8, aimMultiplier = 0.4,
        sprayIncrease = 0.15, returnSpeed = 0.085, patternScale = 0.055, firstShotMultiplier = 0.9,
        moveMultiplier = 1.45, rpm = 60
    },
    ["RPK"] = {
        kickStrength = 0.065, horizontalStrength = 0.015, gunRise = 0.04, cameraShake = 0.04,
        horizontalRandomness = 0.2, kickRandomness = 0.15, crouchMultiplier = 0.72, aimMultiplier = 0.35,
        sprayIncrease = 0.12, returnSpeed = 0.1, patternScale = 0.045, firstShotMultiplier = 0.75,
        moveMultiplier = 1.35, rpm = 650
    },
    ["P320"] = {
        kickStrength = 0.085, horizontalStrength = 0.05, gunRise = 0.05, cameraShake = 0.04,
        horizontalRandomness = 0.1, kickRandomness = 0.2, crouchMultiplier = 0.72, aimMultiplier = 0.35,
        sprayIncrease = 0.12, returnSpeed = 0.1, patternScale = 0.045, firstShotMultiplier = 0.75,
        moveMultiplier = 1.35, rpm = 400
    },
    ["Benelli"] = {
        kickStrength = 0.0875, horizontalStrength = 0.065, gunRise = 0.07, cameraShake = 0.04,
        horizontalRandomness = 0.2, kickRandomness = 0.15, crouchMultiplier = 0.72, aimMultiplier = 0.35,
        sprayIncrease = 0.12, returnSpeed = 0.1, patternScale = 0.045, firstShotMultiplier = 0.75,
        moveMultiplier = 1.35, rpm = 80
    },
    ["RPG"] = {
        kickStrength = 0.45, horizontalStrength = 0.25, gunRise = 0.2, cameraShake = 0.04,
        horizontalRandomness = 0.1, kickRandomness = 0.15, crouchMultiplier = 0.72, aimMultiplier = 0.35,
        sprayIncrease = 0.12, returnSpeed = 0.1, patternScale = 0.045, firstShotMultiplier = 0.75,
        moveMultiplier = 1.35, rpm = 10
    },
    ["Default"] = {
        kickStrength = 0.055, horizontalStrength = 0.05, gunRise = 0.02, cameraShake = 0.04,
        horizontalRandomness = 0.1, kickRandomness = 0.15, crouchMultiplier = 0.72, aimMultiplier = 0.35,
        sprayIncrease = 0.12, returnSpeed = 0.1, patternScale = 0.045, firstShotMultiplier = 0.75,
        moveMultiplier = 1.35, rpm = 600
    }
}

local BulletPhysics = {
    Speed = 1500,
    Drop = 0.1,
    Gravity = 196.2
}

local VelocityCache = {}
local PositionCache = {}
local LastAimPos = nil
local AimSmoothing = 0

local WeaponToProfile = {
    ["AK-74"] = "AK", ["AK-74M"] = "AK", ["AK-74M Bakelit"] = "AK", ["AK-103"] = "AK",
    ["AK-103 MOD"] = "AK", ["AK-104 MOD"] = "AK", ["AK-47 MOD"] = "AK", ["AKM"] = "AK",
    ["AKM Plastic"] = "AK", ["AKMSN"] = "AK", ["AKS-74U"] = "AK", ["AKS-74"] = "AK",
    ["AK-12"] = "AK", ["AK-12 MOD"] = "AK", ["AK-47"] = "AK", ["AK"] = "AK",
    
    ["M4A1"] = "M4A1", ["M4A1 TAN"] = "M4A1", ["M4A1 Mod"] = "M4A1", ["M4"] = "M4A1",
    ["MK18"] = "M4A1", ["URGI"] = "M4A1", ["HRT MK4"] = "M4A1", ["11.5 BCM"] = "M4A1",
    ["Noveske NSR-9"] = "M4A1", ["LMT Defense DF2000"] = "M4A1", ["M16"] = "M4A1",
    ["HK416"] = "M4A1", ["HK416A5"] = "M4A1", ["HK416D"] = "M4A1",
    ["FN SCAR-L"] = "M4A1", ["SCAR-L"] = "M4A1", ["FN SCAR-H"] = "M4A1", ["SCAR-H"] = "M4A1",
    ["SIG MCX Spear"] = "M4A1", ["MCX"] = "M4A1", ["G36"] = "M4A1", ["G36C"] = "M4A1",
    ["L85A2"] = "M4A1", ["FAMAS"] = "M4A1", ["AUG"] = "M4A1", ["Steyr AUG"] = "M4A1",
    ["QBZ-95"] = "M4A1", ["Type 95"] = "M4A1", ["Galil"] = "M4A1",
    
    ["SVD"] = "SVD", ["SVD-K"] = "SVD", ["Dragunov"] = "SVD", ["DVL-10"] = "SVD",
    ["G3A3"] = "SVD", ["G3"] = "SVD", ["HK G3"] = "SVD", ["PSG1"] = "SVD",
    ["M14"] = "SVD", ["M14 EBR"] = "SVD", ["SR-25"] = "SVD", ["Mk 11"] = "SVD",
    ["M110"] = "SVD", ["RSASS"] = "SVD", ["SSG 69"] = "SVD", ["AWM"] = "SVD",
    ["L96"] = "SVD", ["M24"] = "SVD", ["R700"] = "SVD", ["Mosin"] = "SVD",
    ["Kar98k"] = "SVD", ["M40A5"] = "SVD", ["MSR"] = "SVD", ["Intervention"] = "SVD",
    
    ["RPK"] = "RPK", ["RPK-74"] = "RPK", ["PKM"] = "RPK", ["PKP"] = "RPK",
    ["M249"] = "RPK", ["M249 SAW"] = "RPK", ["M240B"] = "RPK", ["M240"] = "RPK",
    ["M60"] = "RPK", ["MG3"] = "RPK", ["MG42"] = "RPK", ["Negev"] = "RPK",
    ["L86 LSW"] = "RPK", ["RPD"] = "RPK", ["DP-28"] = "RPK",
    
    ["P320"] = "P320", ["SIG P320"] = "P320", ["M17"] = "P320", ["M18"] = "P320",
    ["Glock"] = "P320", ["Glock 17"] = "P320", ["Glock 19"] = "P320", ["G17"] = "P320", ["G19"] = "P320",
    ["M9"] = "P320", ["Beretta"] = "P320", ["M1911"] = "P320", ["1911"] = "P320",
    ["USP"] = "P320", ["P226"] = "P320", ["Five-Seven"] = "P320", ["Desert Eagle"] = "P320",
    ["Deagle"] = "P320", ["TT-33"] = "P320", ["Makarov"] = "P320", ["CZ-75"] = "P320",
    
    ["MP5"] = "M4A1", ["MP5A3"] = "M4A1", ["MP5SD"] = "M4A1", ["MP5K"] = "M4A1",
    ["MP7"] = "M4A1", ["MP9"] = "M4A1", ["UMP45"] = "M4A1", ["Vector"] = "M4A1",
    ["P90"] = "M4A1", ["PP-19"] = "M4A1", ["Bizon"] = "M4A1", ["Scorpion"] = "M4A1",
    ["MAC-10"] = "M4A1", ["Uzi"] = "M4A1", ["Kriss Vector"] = "M4A1",
    
    ["Benelli M3 14.5 Super"] = "Benelli", ["Benelli"] = "Benelli", ["M3 Super"] = "Benelli",
    ["M870"] = "Benelli", ["Remington 870"] = "Benelli", ["SPAS-12"] = "Benelli",
    ["M1014"] = "Benelli", ["AA-12"] = "Benelli", ["Saiga-12"] = "Benelli",
    ["KSG"] = "Benelli", ["Model 680"] = "Benelli", ["725"] = "Benelli",
    
    ["RPG-7"] = "RPG", ["RPG-26"] = "RPG", ["M67"] = "RPG", ["Smoke"] = "RPG", ["AT4"] = "RPG",
    ["SMAW"] = "RPG", ["Javelin"] = "RPG", ["Stinger"] = "RPG", ["MAAWS"] = "RPG",
    ["M72 LAW"] = "RPG", ["Panzerfaust"] = "RPG", ["Carl Gustaf"] = "RPG"
}

local Tuning = {
    BoxRatio = 0.55,
    NameSize = 13,
    DistSize = 11,
    HealthBarWidth = 2,
    BoxThickness = 1
}

local Palette = {
    Enemy = Color3.fromRGB(220, 60, 60),
    EnemyVisible = Color3.fromRGB(50, 220, 50),
    Friendly = Color3.fromRGB(100, 180, 255),
    FOV = Color3.fromRGB(255, 255, 255),
    Drone = Color3.fromRGB(255, 180, 50)
}

local State = {
    Unloaded = false,
    CurrentRecoilProfile = nil,
    ShotsFired = 0,
    LastShotTime = 0,
    IsAiming = false,
    IsCrouching = false,
    IsFiring = false,
    LastFireTick = 0,
    SprayTime = 0,
    AccumulatedRecoil = Vector2.new(0, 0),
    LastCameraShake = CFrame.new(),
    OriginalCamCF = nil,
    LockedCameraCF = nil,
    LastCameraCF = nil,
    RecoilModulesPatched = false,
    PatchedTables = {}
}

local ESP = { cache = {} }
local Chams = { cache = {} }
local DroneESP = { cache = {} }
local VelocityCache = {}
local Connections = {}

local FOVCircle = Drawing.new("Circle")
FOVCircle.Thickness = 1
FOVCircle.Color = Palette.FOV
FOVCircle.Filled = false
FOVCircle.Transparency = 0.5
FOVCircle.Radius = 100
FOVCircle.Visible = Config.AIM_ShowFOV and Config.AIM_Enabled

local function Create(class)
    return Drawing.new(class)
end

function ESP.New()
    return {
        BoxTop = Create("Line"),
        BoxBottom = Create("Line"),
        BoxLeft = Create("Line"),
        BoxRight = Create("Line"),
        Name = Create("Text"),
        Distance = Create("Text"),
        HealthBarBG = Create("Line"),
        HealthBar = Create("Line")
    }
end

function ESP.Setup(esp)
    for _, line in pairs({esp.BoxTop, esp.BoxBottom, esp.BoxLeft, esp.BoxRight}) do
        line.Thickness = 1
        line.Visible = false
    end
    
    esp.Name.Size = Tuning.NameSize
    esp.Name.Center = true
    esp.Name.Outline = true
    esp.Name.Font = Drawing.Fonts.Monospace
    esp.Name.Visible = false
    
    esp.Distance.Size = Tuning.DistSize
    esp.Distance.Center = true
    esp.Distance.Outline = true
    esp.Distance.Font = Drawing.Fonts.Monospace
    esp.Distance.Visible = false
    
    esp.HealthBarBG.Thickness = Tuning.HealthBarWidth + 2
    esp.HealthBarBG.Color = Color3.fromRGB(0, 0, 0)
    esp.HealthBarBG.Visible = false
    
    esp.HealthBar.Thickness = Tuning.HealthBarWidth
    esp.HealthBar.Visible = false
end

function ESP.Get(player)
    if not ESP.cache[player] then
        local e = ESP.New()
        ESP.Setup(e)
        ESP.cache[player] = e
    end
    return ESP.cache[player]
end

function ESP.Hide(esp)
    if not esp then return end
    esp.BoxTop.Visible = false
    esp.BoxBottom.Visible = false
    esp.BoxLeft.Visible = false
    esp.BoxRight.Visible = false
    esp.Name.Visible = false
    esp.Distance.Visible = false
    esp.HealthBar.Visible = false
    esp.HealthBarBG.Visible = false
end

function ESP.Destroy(esp)
    if not esp then return end
    pcall(function()
        esp.BoxTop:Remove()
        esp.BoxBottom:Remove()
        esp.BoxLeft:Remove()
        esp.BoxRight:Remove()
        esp.Name:Remove()
        esp.Distance:Remove()
        esp.HealthBar:Remove()
        esp.HealthBarBG:Remove()
    end)
end

function ESP.Remove(player)
    local e = ESP.cache[player]
    if e then
        ESP.Hide(e)
        ESP.Destroy(e)
        ESP.cache[player] = nil
    end
end

function Chams.Create(char, isEnemy, isVisible)
    if Chams.cache[char] then return end
    
    local highlight = Instance.new("Highlight")
    highlight.Name = "H"
    highlight.Adornee = char
    highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
    highlight.FillTransparency = Config.CHAMS_FillTransparency
    highlight.OutlineTransparency = Config.CHAMS_OutlineTransparency
    
    local color = Palette.Friendly
    if isEnemy then
        color = isVisible and Palette.EnemyVisible or Palette.Enemy
    end
    highlight.FillColor = color
    highlight.OutlineColor = color
    highlight.Parent = char
    
    Chams.cache[char] = highlight
end

function Chams.Update(char, isEnemy, isVisible)
    local h = Chams.cache[char]
    if not h then return end
    
    local color = Palette.Friendly
    if isEnemy then
        color = isVisible and Palette.EnemyVisible or Palette.Enemy
    end
    h.FillColor = color
    h.OutlineColor = color
    h.FillTransparency = Config.CHAMS_FillTransparency
    h.OutlineTransparency = Config.CHAMS_OutlineTransparency
end

function Chams.Remove(char)
    local h = Chams.cache[char]
    if h then
        pcall(function() h:Destroy() end)
        Chams.cache[char] = nil
    end
end

function Chams.ClearAll()
    for char, h in pairs(Chams.cache) do
        pcall(function() h:Destroy() end)
    end
    Chams.cache = {}
end

function DroneESP.New()
    return {
        Box = Drawing.new("Square"),
        Name = Drawing.new("Text"),
        Distance = Drawing.new("Text")
    }
end

function DroneESP.Setup(d)
    d.Box.Thickness = 1
    d.Box.Filled = false
    d.Box.Color = Palette.Drone
    d.Box.Visible = false
    
    d.Name.Size = 12
    d.Name.Center = true
    d.Name.Outline = true
    d.Name.Font = Drawing.Fonts.Monospace
    d.Name.Color = Palette.Drone
    d.Name.Visible = false
    
    d.Distance.Size = 10
    d.Distance.Center = true
    d.Distance.Outline = true
    d.Distance.Font = Drawing.Fonts.Monospace
    d.Distance.Color = Palette.Drone
    d.Distance.Visible = false
end

function DroneESP.Get(drone)
    if not DroneESP.cache[drone] then
        local d = DroneESP.New()
        DroneESP.Setup(d)
        DroneESP.cache[drone] = d
    end
    return DroneESP.cache[drone]
end

function DroneESP.Hide(d)
    if not d then return end
    d.Box.Visible = false
    d.Name.Visible = false
    d.Distance.Visible = false
end

function DroneESP.Destroy(d)
    if not d then return end
    pcall(function()
        d.Box:Remove()
        d.Name:Remove()
        d.Distance:Remove()
    end)
end

function DroneESP.Remove(drone)
    local d = DroneESP.cache[drone]
    if d then
        DroneESP.Hide(d)
        DroneESP.Destroy(d)
        DroneESP.cache[drone] = nil
    end
end

function DroneESP.ClearAll()
    for drone, d in pairs(DroneESP.cache) do
        DroneESP.Hide(d)
        DroneESP.Destroy(d)
    end
    DroneESP.cache = {}
end

local function GetVelocity(player, part)
    if not part then return Vector3.zero end
    if not player then return Vector3.zero end
    
    local vel = Vector3.zero
    pcall(function() vel = part.AssemblyLinearVelocity end)
    return vel
end

local function CalculateAimPoint(targetPos, targetVel, myPos)
    local bulletSpeed = BulletPhysics.Speed
    local gravityDrop = BulletPhysics.Gravity * BulletPhysics.Drop
    
    local toTarget = targetPos - myPos
    local dist = toTarget.Magnitude
    
    if dist < 10 then
        return targetPos
    end
    
    local flightTime = dist / bulletSpeed
    
    for i = 1, 4 do
        local predictedPos = targetPos + targetVel * flightTime
        local newDist = (predictedPos - myPos).Magnitude
        flightTime = newDist / bulletSpeed
    end
    
    flightTime = flightTime * Config.AIM_PredictionAmount
    
    local leadX = targetPos.X + targetVel.X * flightTime
    local leadZ = targetPos.Z + targetVel.Z * flightTime
    local leadY = targetPos.Y + targetVel.Y * flightTime
    
    local drop = 0.5 * gravityDrop * flightTime * flightTime
    leadY = leadY + drop
    
    return Vector3.new(leadX, leadY, leadZ)
end

local function IsEnemy(player)
    if not player or not LocalPlayer then return false end
    local myTeam = LocalPlayer.Team
    local theirTeam = player.Team
    if not myTeam or not theirTeam then return true end
    return myTeam ~= theirTeam
end

local function GetCharacter(player)
    return player and player.Character
end

local function GetHumanoid(char)
    return char and char:FindFirstChildOfClass("Humanoid")
end

local function GetRootPart(char)
    return char and char:FindFirstChild("HumanoidRootPart")
end

local function GetHead(char)
    return char and char:FindFirstChild("Head")
end

local function GetDistance(pos)
    local myChar = GetCharacter(LocalPlayer)
    local myRoot = GetRootPart(myChar)
    if not myRoot then return 9999 end
    return (pos - myRoot.Position).Magnitude
end

local function IsInSpawn(hrp)
    if not Config.ESP_HideSpawn then return false end
    if not hrp then return true end
    return hrp.Position.Y < Config.ESP_SpawnY
end

local function WorldToScreen(pos)
    local screenPos, onScreen = Camera:WorldToViewportPoint(pos)
    return Vector2.new(screenPos.X, screenPos.Y), onScreen, screenPos.Z
end

local function IsVisible(targetPos, targetChar)
    local myChar = GetCharacter(LocalPlayer)
    if not myChar then return false end
    local myHead = myChar:FindFirstChild("Head")
    if not myHead then return false end
    
    local origin = myHead.Position
    local direction = targetPos - origin
    
    local params = RaycastParams.new()
    params.FilterType = Enum.RaycastFilterType.Exclude
    params.FilterDescendantsInstances = {myChar, targetChar, Camera}
    
    local result = Workspace:Raycast(origin, direction, params)
    return result == nil
end

local function GetCurrentWeapon()
    local char = GetCharacter(LocalPlayer)
    if not char then return nil, nil end
    
    for _, child in pairs(char:GetChildren()) do
        if child:IsA("Tool") then
            return child.Name, child
        end
    end
    return nil, nil
end

local function GetRecoilProfile()
    local weaponName = GetCurrentWeapon()
    if not weaponName then return nil end
    
    local profileName = WeaponToProfile[weaponName]
    if profileName then
        return RecoilProfiles[profileName], profileName
    end
    
    for name, profile in pairs(WeaponToProfile) do
        if string.find(string.lower(weaponName), string.lower(name)) then
            return RecoilProfiles[profile], profile
        end
    end
    
    return RecoilProfiles["AK"], "AK"
end

local function CalculateRecoilCompensation(profile, shotNum, deltaTime)
    local baseVertical = profile.kickStrength + profile.gunRise
    local baseHorizontal = profile.horizontalStrength
    
    local sprayFactor = 1 + math.min(shotNum * profile.sprayIncrease, 2.0)
    local firstShotMult = shotNum == 1 and profile.firstShotMultiplier or 1.0
    
    local verticalRecoil = baseVertical * sprayFactor * firstShotMult
    local horizontalRecoil = baseHorizontal * sprayFactor
    
    local patternPhase = (shotNum * profile.patternSpeed) % 360
    local patternOffset = math.sin(math.rad(patternPhase)) * profile.patternScale
    horizontalRecoil = horizontalRecoil + patternOffset
    
    local multiplier = 1.0
    if State.IsAiming then
        multiplier = multiplier * profile.aimMultiplier
    end
    if State.IsCrouching then
        multiplier = multiplier * profile.crouchMultiplier
    end
    
    verticalRecoil = verticalRecoil * multiplier
    horizontalRecoil = horizontalRecoil * multiplier
    
    return verticalRecoil, horizontalRecoil
end

local function ApplyRecoilCompensation(deltaX, deltaY)
    if not Config.RECOIL_Enabled then return deltaX, deltaY end
    
    local profile, profileName = GetRecoilProfile()
    if not profile then 
        profile = RecoilProfiles["Default"]
    end
    
    local now = tick()
    local timeSinceLastShot = now - State.LastShotTime
    
    if timeSinceLastShot < 60 / (profile.rpm or 600) * 1.5 then
        State.ShotsFired = State.ShotsFired + 1
        State.SprayTime = State.SprayTime + timeSinceLastShot
    else
        State.ShotsFired = 1
        State.SprayTime = 0
        State.AccumulatedRecoil = Vector2.new(0, 0)
    end
    State.LastShotTime = now
    
    local vertComp, horzComp = CalculateRecoilCompensation(profile, State.ShotsFired, timeSinceLastShot)
    
    local screenScale = Camera.ViewportSize.Y / 1080
    local baseScale = 120 * Config.RECOIL_Strength * screenScale
    
    vertComp = vertComp * baseScale
    horzComp = horzComp * baseScale * 0.6
    
    State.AccumulatedRecoil = State.AccumulatedRecoil + Vector2.new(horzComp, vertComp)
    
    return deltaX - horzComp, deltaY - vertComp
end

local function StandaloneAntiRecoil()
    if not Config.RECOIL_Enabled then return end
    
    local mouse1Down = UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
    
    if not mouse1Down then 
        State.IsFiring = false
        State.ShotsFired = 0
        State.SprayTime = 0
        return 
    end
    
    local profile = RecoilProfiles["Default"]
    local weaponName = GetCurrentWeapon()
    if weaponName then
        local pName = WeaponToProfile[weaponName]
        if pName and RecoilProfiles[pName] then
            profile = RecoilProfiles[pName]
        end
    end
    
    local now = tick()
    local rpm = profile.rpm or 600
    local fireInterval = 60 / rpm
    
    if not State.IsFiring then
        State.IsFiring = true
        State.ShotsFired = 1
        State.LastFireTick = now
        State.SprayTime = 0
    else
        if now - State.LastFireTick >= fireInterval then
            State.ShotsFired = State.ShotsFired + 1
            State.LastFireTick = now
        end
        State.SprayTime = State.SprayTime + (1/60)
    end
    
    local baseKick = profile.kickStrength + profile.gunRise
    local sprayMult = 1 + math.min(State.ShotsFired * profile.sprayIncrease * 0.5, 1.0)
    
    if State.ShotsFired == 1 then
        baseKick = baseKick * (profile.firstShotMultiplier or 0.75)
    end
    
    if State.IsAiming then
        baseKick = baseKick * (profile.aimMultiplier or 0.35)
    end
    
    if State.IsCrouching then
        baseKick = baseKick * (profile.crouchMultiplier or 0.72)
    end
    
    local perFrameComp = baseKick * sprayMult * 45 * Config.RECOIL_Strength
    
    if mousemoverel then
        mousemoverel(0, perFrameComp)
    end
end


local function ScanAndPatchGC()
end

local function PatchWeaponModules()
end

local function RemoveCameraShake()
    if not Config.NO_CAMSHAKE then return end
    
    pcall(function()
        local char = LocalPlayer.Character
        if not char then return end
        
        local humanoid = char:FindFirstChildOfClass("Humanoid")
        if humanoid then
            humanoid.CameraOffset = Vector3.new(0, 0, 0)
        end
    end)
end

local function RemoveGunBob()
    if not Config.NO_GUNBOB then return end
end



local function GetBestTarget()
    if not Config.AIM_Enabled then return nil end
    
    local mousePos = UserInputService:GetMouseLocation()
    local bestTarget = nil
    local bestScore = math.huge
    
    for _, player in pairs(Players:GetPlayers()) do
        if player == LocalPlayer then continue end
        if Config.AIM_TeamCheck and not IsEnemy(player) then continue end
        
        local char = GetCharacter(player)
        if not char then continue end
        
        local hum = GetHumanoid(char)
        if not hum or hum.Health <= 0 then continue end
        
        local hrp = GetRootPart(char)
        if IsInSpawn(hrp) then continue end
        
        local targetPart = char:FindFirstChild(Config.AIM_TargetPart) or GetHead(char) or hrp
        if not targetPart then continue end
        
        local screenPos, onScreen, depth = WorldToScreen(targetPart.Position)
        if not onScreen or depth <= 0 then continue end
        
        local dist = GetDistance(targetPart.Position)
        if dist > Config.ESP_MaxDistance then continue end
        
        local screenDist = (screenPos - mousePos).Magnitude
        if screenDist > Config.AIM_FOV then continue end
        
        local score = screenDist + (dist * 0.01)
        
        if score < bestScore then
            bestScore = score
            bestTarget = {
                Player = player,
                Part = targetPart,
                ScreenPos = screenPos,
                Distance = dist,
                Health = hum.Health
            }
        end
    end
    
    return bestTarget
end

local function AimAt(target)
    if not target or not target.Part then return end
    
    local myPos = Camera.CFrame.Position
    local targetPos = target.Part.Position
    local distance = target.Distance
    
    local char = target.Player.Character
    local hrp = GetRootPart(char)
    local velocity = Vector3.zero
    
    if hrp then
        velocity = GetVelocity(target.Player, hrp)
    end
    
    if Config.AIM_Prediction then
        targetPos = CalculateAimPoint(targetPos, velocity, myPos)
    end
    
    local screenPos = Camera:WorldToViewportPoint(targetPos)
    if screenPos.Z <= 0 then return end
    
    local screenCenter = Camera.ViewportSize / 2
    local deltaX = screenPos.X - screenCenter.X
    local deltaY = screenPos.Y - screenCenter.Y
    local deltaMag = math.sqrt(deltaX * deltaX + deltaY * deltaY)
    
    if deltaMag < 0.5 then return end
    
    local smooth = Config.AIM_Smooth
    
    local moveX = deltaX * smooth
    local moveY = deltaY * smooth
    
    if deltaMag > 50 then
        moveX = deltaX * math.min(smooth * 2, 0.5)
        moveY = deltaY * math.min(smooth * 2, 0.5)
    end
    
    if mousemoverel then
        mousemoverel(moveX, moveY)
    end
end

local LastChamsClean = 0
local ESPFrameCounter = 0
local VisibilityCache = {}
local LastVisibilityCheck = 0

local function RenderESP()
    if State.Unloaded then return end
    
    ESPFrameCounter = ESPFrameCounter + 1
    
    Camera = Workspace.CurrentCamera
    if not Camera then return end
    
    local screenSize = Camera.ViewportSize
    
    FOVCircle.Position = UserInputService:GetMouseLocation()
    FOVCircle.Radius = Config.AIM_FOV
    FOVCircle.Visible = Config.AIM_ShowFOV and Config.AIM_Enabled
    
    local now = tick()
    
    if now - LastChamsClean > 3 then
        LastChamsClean = now
        for oldChar, _ in pairs(Chams.cache) do
            if not oldChar or not oldChar.Parent then
                Chams.Remove(oldChar)
            end
        end
    end
    
    local doVisibilityCheck = now - LastVisibilityCheck > 0.15
    if doVisibilityCheck then
        LastVisibilityCheck = now
    end
    
    for _, player in pairs(Players:GetPlayers()) do
        if player == LocalPlayer then continue end
        
        local esp = ESP.Get(player)
        local char = GetCharacter(player)
        
        if not char or not char.Parent then
            ESP.Hide(esp)
            continue
        end
        
        local hum = GetHumanoid(char)
        local hrp = GetRootPart(char)
        local head = GetHead(char)
        
        if not hum or not hrp or hum.Health <= 0 then
            ESP.Hide(esp)
            Chams.Remove(char)
            continue
        end
        
        local rootPos, onScreen, depth = WorldToScreen(hrp.Position)
        if not onScreen or depth <= 0 then
            ESP.Hide(esp)
            continue
        end
        
        local dist = GetDistance(hrp.Position)
        if dist > Config.ESP_MaxDistance then
            ESP.Hide(esp)
            Chams.Remove(char)
            continue
        end
        
        local isEnemy = IsEnemy(player)
        if Config.ESP_TeamCheck and not isEnemy then
            ESP.Hide(esp)
            Chams.Remove(char)
            continue
        end
        
        if IsInSpawn(hrp) then
            ESP.Hide(esp)
            Chams.Remove(char)
            continue
        end
        
        local isVisible = VisibilityCache[player]
        if doVisibilityCheck then
            isVisible = IsVisible(hrp.Position, char)
            VisibilityCache[player] = isVisible
        end
        isVisible = isVisible or false
        
        local color = Palette.Friendly
        if isEnemy then
            color = isVisible and Palette.EnemyVisible or Palette.Enemy
        end
        
        local boxHeight = math.clamp(800 / math.max(depth, 1), 20, 120)
        local boxWidth = boxHeight * Tuning.BoxRatio
        
        local halfW = boxWidth / 2
        local halfH = boxHeight / 2
        local topY = rootPos.Y - halfH * 1.1
        local bottomY = rootPos.Y + halfH * 0.9
        
        local topLeft = Vector2.new(rootPos.X - halfW, topY)
        local topRight = Vector2.new(rootPos.X + halfW, topY)
        local bottomLeft = Vector2.new(rootPos.X - halfW, bottomY)
        local bottomRight = Vector2.new(rootPos.X + halfW, bottomY)
        
        if Config.ESP_Enabled and Config.ESP_Box then
            esp.BoxTop.From = topLeft
            esp.BoxTop.To = topRight
            esp.BoxTop.Color = color
            esp.BoxTop.Visible = true
            
            esp.BoxBottom.From = bottomLeft
            esp.BoxBottom.To = bottomRight
            esp.BoxBottom.Color = color
            esp.BoxBottom.Visible = true
            
            esp.BoxLeft.From = topLeft
            esp.BoxLeft.To = bottomLeft
            esp.BoxLeft.Color = color
            esp.BoxLeft.Visible = true
            
            esp.BoxRight.From = topRight
            esp.BoxRight.To = bottomRight
            esp.BoxRight.Color = color
            esp.BoxRight.Visible = true
        else
            esp.BoxTop.Visible = false
            esp.BoxBottom.Visible = false
            esp.BoxLeft.Visible = false
            esp.BoxRight.Visible = false
        end
        
        if Config.ESP_Enabled and Config.ESP_Name then
            esp.Name.Text = player.Name
            esp.Name.Position = Vector2.new(rootPos.X, topY - 14)
            esp.Name.Color = color
            esp.Name.Visible = true
        else
            esp.Name.Visible = false
        end
        
        if Config.ESP_Enabled and Config.ESP_Distance then
            esp.Distance.Text = string.format("%dm", math.floor(dist))
            esp.Distance.Position = Vector2.new(rootPos.X, bottomY + 2)
            esp.Distance.Color = color
            esp.Distance.Visible = true
        else
            esp.Distance.Visible = false
        end
        
        if Config.ESP_Enabled and Config.ESP_Health then
            local healthPercent = math.clamp(hum.Health / hum.MaxHealth, 0, 1)
            local barFullHeight = bottomY - topY
            local barHeight = barFullHeight * healthPercent
            local barTop = bottomY - barHeight
            
            esp.HealthBarBG.From = Vector2.new(topLeft.X - 5, topY)
            esp.HealthBarBG.To = Vector2.new(topLeft.X - 5, bottomY)
            esp.HealthBarBG.Visible = true
            
            local healthColor = Color3.fromRGB(
                math.floor(255 * (1 - healthPercent)),
                math.floor(255 * healthPercent),
                0
            )
            
            esp.HealthBar.From = Vector2.new(topLeft.X - 5, barTop)
            esp.HealthBar.To = Vector2.new(topLeft.X - 5, bottomY)
            esp.HealthBar.Color = healthColor
            esp.HealthBar.Visible = true
        else
            esp.HealthBar.Visible = false
            esp.HealthBarBG.Visible = false
        end
        
        if Config.CHAMS_Enabled then
            if not Chams.cache[char] then
                Chams.Create(char, isEnemy, isVisible)
            else
                Chams.Update(char, isEnemy, isVisible)
            end
        else
            Chams.Remove(char)
        end
    end
end

local DroneCache = {}
local LastDroneScan = 0

local function FindDrones()
    local now = tick()
    if now - LastDroneScan < 1.0 then
        return DroneCache
    end
    LastDroneScan = now
    DroneCache = {}
    
    local droneFolder = Workspace:FindFirstChild("DroneWorkspace")
    if droneFolder then
        for _, obj in pairs(droneFolder:GetChildren()) do
            if obj:IsA("Model") then
                table.insert(DroneCache, obj)
            end
        end
    end
    
    return DroneCache
end

local DroneESPFrame = 0

local function RenderDroneESP()
    if State.Unloaded then return end
    if not Config.DRONE_ESP then
        for drone, d in pairs(DroneESP.cache) do
            DroneESP.Hide(d)
        end
        return
    end
    
    DroneESPFrame = DroneESPFrame + 1
    if DroneESPFrame % 3 ~= 0 then return end
    
    local drones = FindDrones()
    local activeDrones = {}
    
    for _, drone in pairs(drones) do
        activeDrones[drone] = true
        local d = DroneESP.Get(drone)
        
        local primary = drone.PrimaryPart or drone:FindFirstChildWhichIsA("BasePart")
        if not primary then
            DroneESP.Hide(d)
            continue
        end
        
        local screenPos, onScreen, depth = WorldToScreen(primary.Position)
        if not onScreen or depth <= 0 then
            DroneESP.Hide(d)
            continue
        end
        
        local dist = GetDistance(primary.Position)
        if dist > Config.DRONE_MaxDistance then
            DroneESP.Hide(d)
            continue
        end
        
        local boxSize = math.clamp(400 / math.max(depth, 1), 15, 60)
        
        d.Box.Position = Vector2.new(screenPos.X - boxSize/2, screenPos.Y - boxSize/2)
        d.Box.Size = Vector2.new(boxSize, boxSize)
        d.Box.Visible = true
        
        d.Name.Text = drone.Name
        d.Name.Position = Vector2.new(screenPos.X, screenPos.Y - boxSize/2 - 12)
        d.Name.Visible = true
        
        d.Distance.Text = string.format("%dm", math.floor(dist))
        d.Distance.Position = Vector2.new(screenPos.X, screenPos.Y + boxSize/2 + 2)
        d.Distance.Visible = true
    end
    
    for drone, d in pairs(DroneESP.cache) do
        if not activeDrones[drone] then
            DroneESP.Remove(drone)
        end
    end
end

local function GetClosestEnemy()
    local closest = nil
    local closestDist = math.huge
    local myChar = GetCharacter(LocalPlayer)
    local myRoot = GetRootPart(myChar)
    if not myRoot then return nil end
    
    for _, player in pairs(Players:GetPlayers()) do
        if player == LocalPlayer then continue end
        if Config.AIM_TeamCheck and not IsEnemy(player) then continue end
        
        local char = GetCharacter(player)
        if not char then continue end
        
        local hum = GetHumanoid(char)
        if not hum or hum.Health <= 0 then continue end
        
        local hrp = GetRootPart(char)
        if not hrp then continue end
        
        if IsInSpawn(hrp) then continue end
        
        local dist = (hrp.Position - myRoot.Position).Magnitude
        if dist < closestDist then
            closestDist = dist
            closest = {Player = player, Character = char, HRP = hrp, Distance = dist}
        end
    end
    
    return closest
end

local TPTarget = nil
local TPActive = false
local TPKeyDebounce = false
local TPLastShot = 0
local TPFrameSkip = 0
local TPShotCount = 0
local TPLastReload = 0
local TPMagSize = 30

local function TeleportBehindAndAim(target)
    if not target or not target.HRP then return end
    
    local myChar = GetCharacter(LocalPlayer)
    if not myChar then return end
    
    local myRoot = GetRootPart(myChar)
    if not myRoot then return end
    
    local enemyHRP = target.HRP
    if not enemyHRP or not enemyHRP.Parent then return end
    
    local enemyPos = enemyHRP.Position
    local enemyLook = enemyHRP.CFrame.LookVector
    
    local behindPos = enemyPos - (enemyLook * Config.TP_Distance)
    behindPos = Vector3.new(behindPos.X, enemyPos.Y, behindPos.Z)
    
    myRoot.CFrame = CFrame.new(behindPos)
    
    pcall(function()
        myRoot.AssemblyLinearVelocity = Vector3.zero
    end)
    
    local head = target.Character:FindFirstChild("Head")
    local aimTarget = head and head.Position or enemyPos
    
    local camPos = behindPos + Vector3.new(0, 1.5, 0)
    Camera.CFrame = CFrame.new(camPos, aimTarget)
end

local function GetMagSize()
    local weaponName = GetCurrentWeapon()
    if not weaponName then return 30 end
    
    local name = string.lower(weaponName)
    
    if name:match("m4") or name:match("hk416") or name:match("scar") then return 30
    elseif name:match("ak") then return 30
    elseif name:match("rpk") or name:match("m249") or name:match("pkm") then return 100
    elseif name:match("svd") or name:match("m14") or name:match("sks") then return 10
    elseif name:match("benelli") or name:match("shotgun") or name:match("870") then return 8
    elseif name:match("p320") or name:match("glock") or name:match("pistol") then return 17
    elseif name:match("rpg") or name:match("launcher") then return 1
    elseif name:match("mp5") or name:match("mp7") or name:match("smg") then return 30
    else return 30 end
end

local function TPReload()
    local now = tick()
    if now - TPLastReload < 2.5 then return true end
    
    TPLastReload = now
    TPShotCount = 0
    TPMagSize = GetMagSize()
    
    pcall(function()
        if keypress then
            keypress(0x52)
            task.delay(0.1, function()
                if keyrelease then keyrelease(0x52) end
            end)
        end
    end)
    
    return true
end

local function TPAutoShoot()
    if not Config.TP_AutoShoot then return end
    
    local now = tick()
    
    if now - TPLastReload < 2.5 then
        return
    end
    
    if TPShotCount >= TPMagSize then
        TPReload()
        return
    end
    
    if now - TPLastShot < 0.25 then return end
    TPLastShot = now
    TPShotCount = TPShotCount + 1
    
    pcall(function()
        if mouse1click then
            mouse1click()
        end
    end)
end

local function ProcessTeleport()
    if not Config.TP_Enabled then 
        TPActive = false
        return 
    end
    
    local keyDown = UserInputService:IsKeyDown(Config.TP_Key)
    
    if keyDown and not TPKeyDebounce then
        TPKeyDebounce = true
        TPActive = not TPActive
        
        if TPActive then
            TPTarget = GetClosestEnemy()
            TPShotCount = 0
            TPMagSize = GetMagSize()
        else
            TPTarget = nil
        end
    elseif not keyDown then
        TPKeyDebounce = false
    end
    
    if not TPActive then return end
    
    TPFrameSkip = TPFrameSkip + 1
    if TPFrameSkip < 2 then return end
    TPFrameSkip = 0
    
    if TPTarget then
        local char = TPTarget.Player.Character
        if char then
            local hrp = char:FindFirstChild("HumanoidRootPart")
            local hum = char:FindFirstChildOfClass("Humanoid")
            
            if hrp and hum and hum.Health > 0 and not IsInSpawn(hrp) then
                TPTarget.HRP = hrp
                TPTarget.Character = char
                TeleportBehindAndAim(TPTarget)
                TPAutoShoot()
            else
                TPTarget = GetClosestEnemy()
            end
        else
            TPTarget = GetClosestEnemy()
        end
    else
        TPTarget = GetClosestEnemy()
    end
end

local function ProcessAimbot()
    if State.Unloaded then return end
    if not Config.AIM_Enabled then return end
    
    local holdingAimKey = UserInputService:IsMouseButtonPressed(Config.AIM_Key)
    local holdingFire = UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
    
    if not holdingAimKey and not holdingFire then return end
    
    local target = GetBestTarget()
    if target then
        AimAt(target)
    end
end

local function UpdateState()
    local char = GetCharacter(LocalPlayer)
    if not char then return end
    
    local hum = GetHumanoid(char)
    if hum then
        State.IsCrouching = hum:GetState() == Enum.HumanoidStateType.None
    end
    
    State.IsAiming = UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2)
end

local function MainLoop()
    if State.Unloaded then return end
    
    UpdateState()
    RenderESP()
    RenderDroneESP()
    ProcessAimbot()
    ProcessTeleport()
    StandaloneAntiRecoil()
end

local Unload
local ScreenGui = nil
local MobileTPBtn = nil

local function CreateMenu()
    local isMobile = UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled
    
    ScreenGui = Instance.new("ScreenGui")
    ScreenGui.Name = "WarfareESP"
    ScreenGui.ResetOnSpawn = false
    ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
    ScreenGui.IgnoreGuiInset = true
    
    pcall(function()
        if syn then
            syn.protect_gui(ScreenGui)
        elseif gethui then
            ScreenGui.Parent = gethui()
            return
        end
    end)
    
    ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
    
    local Accent = Color3.fromRGB(220, 60, 60)
    local GlassBg = Color3.fromRGB(40, 44, 52)
    local GlassCard = Color3.fromRGB(55, 60, 70)
    local TextPrimary = Color3.fromRGB(255, 255, 255)
    local TextSecondary = Color3.fromRGB(140, 145, 155)
    
    local MainContainer = Instance.new("Frame")
    MainContainer.Name = "MainContainer"
    MainContainer.AnchorPoint = Vector2.new(0.5, 0.5)
    MainContainer.Position = UDim2.new(0.5, 0, 0.5, 0)
    MainContainer.Size = isMobile and UDim2.new(0.88, 0, 0, 380) or UDim2.new(0, 520, 0, 340)
    MainContainer.BackgroundColor3 = GlassBg
    MainContainer.BackgroundTransparency = 0.05
    MainContainer.BorderSizePixel = 0
    MainContainer.ClipsDescendants = true
    MainContainer.Parent = ScreenGui
    
    local MainCorner = Instance.new("UICorner")
    MainCorner.CornerRadius = UDim.new(0, 16)
    MainCorner.Parent = MainContainer
    
    local TopBar = Instance.new("Frame")
    TopBar.Size = UDim2.new(1, 0, 0, 44)
    TopBar.BackgroundColor3 = Color3.fromRGB(35, 38, 46)
    TopBar.BackgroundTransparency = 0.3
    TopBar.BorderSizePixel = 0
    TopBar.Parent = MainContainer
    
    local TopCorner = Instance.new("UICorner")
    TopCorner.CornerRadius = UDim.new(0, 16)
    TopCorner.Parent = TopBar
    
    local Tabs = {"ESP", "Aimbot", "Misc"}
    local TabButtons = {}
    local TabPanels = {}
    
    for i, tabName in ipairs(Tabs) do
        local TabBtn = Instance.new("TextButton")
        TabBtn.Size = UDim2.new(0, 70, 0, 30)
        TabBtn.Position = UDim2.new(0, 12 + (i-1) * 78, 0.5, -15)
        TabBtn.BackgroundColor3 = i == 1 and Accent or GlassCard
        TabBtn.BackgroundTransparency = i == 1 and 0.7 or 1
        TabBtn.BorderSizePixel = 0
        TabBtn.Text = tabName
        TabBtn.TextSize = 12
        TabBtn.Font = i == 1 and Enum.Font.GothamBold or Enum.Font.GothamMedium
        TabBtn.TextColor3 = i == 1 and TextPrimary or TextSecondary
        TabBtn.Parent = TopBar
        
        local TabCorner = Instance.new("UICorner")
        TabCorner.CornerRadius = UDim.new(0, 8)
        TabCorner.Parent = TabBtn
        
        local Panel = Instance.new("ScrollingFrame")
        Panel.Name = tabName .. "Panel"
        Panel.Size = UDim2.new(1, -16, 1, -52)
        Panel.Position = UDim2.new(0, 8, 0, 48)
        Panel.BackgroundTransparency = 1
        Panel.ScrollBarThickness = 3
        Panel.ScrollBarImageColor3 = Accent
        Panel.BorderSizePixel = 0
        Panel.Visible = i == 1
        Panel.Parent = MainContainer
        
        local PanelLayout = Instance.new("UIListLayout")
        PanelLayout.SortOrder = Enum.SortOrder.LayoutOrder
        PanelLayout.Padding = UDim.new(0, 6)
        PanelLayout.Parent = Panel
        
        TabButtons[tabName] = TabBtn
        TabPanels[tabName] = Panel
    end
    
    local PowerBtn = Instance.new("ImageButton")
    PowerBtn.Size = UDim2.new(0, 28, 0, 28)
    PowerBtn.Position = UDim2.new(1, -42, 0.5, -14)
    PowerBtn.BackgroundColor3 = Color3.fromRGB(200, 60, 60)
    PowerBtn.BackgroundTransparency = 0.6
    PowerBtn.BorderSizePixel = 0
    PowerBtn.Image = "rbxassetid://97421363782839"
    PowerBtn.ImageColor3 = TextPrimary
    PowerBtn.Parent = TopBar
    
    local PowerCorner = Instance.new("UICorner")
    PowerCorner.CornerRadius = UDim.new(0, 8)
    PowerCorner.Parent = PowerBtn
    
    PowerBtn.MouseButton1Click:Connect(function()
        Unload()
    end)
    
    for tabName, btn in pairs(TabButtons) do
        btn.MouseButton1Click:Connect(function()
            for name, b in pairs(TabButtons) do
                local isActive = name == tabName
                TweenService:Create(b, TweenInfo.new(0.2), {
                    BackgroundTransparency = isActive and 0.7 or 1,
                    BackgroundColor3 = isActive and Accent or GlassCard
                }):Play()
                b.TextColor3 = isActive and TextPrimary or TextSecondary
                b.Font = isActive and Enum.Font.GothamBold or Enum.Font.GothamMedium
                TabPanels[name].Visible = isActive
            end
        end)
    end
    
    local function CreateToggle(parent, label, default, callback, layoutOrder)
        local Frame = Instance.new("Frame")
        Frame.Size = UDim2.new(1, 0, 0, 38)
        Frame.BackgroundColor3 = GlassCard
        Frame.BackgroundTransparency = 0.4
        Frame.BorderSizePixel = 0
        Frame.LayoutOrder = layoutOrder or 0
        Frame.Parent = parent
        
        local Corner = Instance.new("UICorner")
        Corner.CornerRadius = UDim.new(0, 10)
        Corner.Parent = Frame
        
        local Label = Instance.new("TextLabel")
        Label.Size = UDim2.new(1, -60, 1, 0)
        Label.Position = UDim2.new(0, 12, 0, 0)
        Label.BackgroundTransparency = 1
        Label.Text = label
        Label.TextSize = 12
        Label.Font = Enum.Font.GothamMedium
        Label.TextColor3 = TextPrimary
        Label.TextXAlignment = Enum.TextXAlignment.Left
        Label.Parent = Frame
        
        local ToggleBg = Instance.new("Frame")
        ToggleBg.Size = UDim2.new(0, 40, 0, 22)
        ToggleBg.Position = UDim2.new(1, -50, 0.5, -11)
        ToggleBg.BackgroundColor3 = default and Accent or Color3.fromRGB(60, 65, 75)
        ToggleBg.BorderSizePixel = 0
        ToggleBg.Parent = Frame
        
        local BgCorner = Instance.new("UICorner")
        BgCorner.CornerRadius = UDim.new(1, 0)
        BgCorner.Parent = ToggleBg
        
        local Circle = Instance.new("Frame")
        Circle.Size = UDim2.new(0, 16, 0, 16)
        Circle.Position = default and UDim2.new(1, -19, 0.5, -8) or UDim2.new(0, 3, 0.5, -8)
        Circle.BackgroundColor3 = TextPrimary
        Circle.BorderSizePixel = 0
        Circle.Parent = ToggleBg
        
        local CircleCorner = Instance.new("UICorner")
        CircleCorner.CornerRadius = UDim.new(1, 0)
        CircleCorner.Parent = Circle
        
        local enabled = default
        local Btn = Instance.new("TextButton")
        Btn.Size = UDim2.new(1, 0, 1, 0)
        Btn.BackgroundTransparency = 1
        Btn.Text = ""
        Btn.Parent = Frame
        
        Btn.MouseButton1Click:Connect(function()
            enabled = not enabled
            TweenService:Create(ToggleBg, TweenInfo.new(0.2), {
                BackgroundColor3 = enabled and Accent or Color3.fromRGB(60, 65, 75)
            }):Play()
            TweenService:Create(Circle, TweenInfo.new(0.2, Enum.EasingStyle.Back), {
                Position = enabled and UDim2.new(1, -19, 0.5, -8) or UDim2.new(0, 3, 0.5, -8)
            }):Play()
            callback(enabled)
        end)
        
        return Frame, function(val)
            enabled = val
            ToggleBg.BackgroundColor3 = enabled and Accent or Color3.fromRGB(60, 65, 75)
            Circle.Position = enabled and UDim2.new(1, -19, 0.5, -8) or UDim2.new(0, 3, 0.5, -8)
        end
    end
    
    local function CreateSlider(parent, label, min, max, default, callback, layoutOrder)
        local Frame = Instance.new("Frame")
        Frame.Size = UDim2.new(1, 0, 0, 48)
        Frame.BackgroundColor3 = GlassCard
        Frame.BackgroundTransparency = 0.4
        Frame.BorderSizePixel = 0
        Frame.LayoutOrder = layoutOrder or 0
        Frame.Parent = parent
        
        local Corner = Instance.new("UICorner")
        Corner.CornerRadius = UDim.new(0, 10)
        Corner.Parent = Frame
        
        local Label = Instance.new("TextLabel")
        Label.Size = UDim2.new(0.6, 0, 0, 18)
        Label.Position = UDim2.new(0, 12, 0, 6)
        Label.BackgroundTransparency = 1
        Label.Text = label
        Label.TextSize = 11
        Label.Font = Enum.Font.GothamMedium
        Label.TextColor3 = TextPrimary
        Label.TextXAlignment = Enum.TextXAlignment.Left
        Label.Parent = Frame
        
        local Value = Instance.new("TextLabel")
        Value.Size = UDim2.new(0.3, 0, 0, 18)
        Value.Position = UDim2.new(0.7, -12, 0, 6)
        Value.BackgroundTransparency = 1
        Value.Text = tostring(default)
        Value.TextSize = 11
        Value.Font = Enum.Font.GothamBold
        Value.TextColor3 = Accent
        Value.TextXAlignment = Enum.TextXAlignment.Right
        Value.Parent = Frame
        
        local SliderBg = Instance.new("Frame")
        SliderBg.Size = UDim2.new(1, -24, 0, 6)
        SliderBg.Position = UDim2.new(0, 12, 0, 32)
        SliderBg.BackgroundColor3 = Color3.fromRGB(50, 55, 65)
        SliderBg.BorderSizePixel = 0
        SliderBg.Parent = Frame
        
        local BgCorner = Instance.new("UICorner")
        BgCorner.CornerRadius = UDim.new(1, 0)
        BgCorner.Parent = SliderBg
        
        local Fill = Instance.new("Frame")
        Fill.Size = UDim2.new((default - min) / (max - min), 0, 1, 0)
        Fill.BackgroundColor3 = Accent
        Fill.BorderSizePixel = 0
        Fill.Parent = SliderBg
        
        local FillCorner = Instance.new("UICorner")
        FillCorner.CornerRadius = UDim.new(1, 0)
        FillCorner.Parent = Fill
        
        local dragging = false
        
        local SliderBtn = Instance.new("TextButton")
        SliderBtn.Size = UDim2.new(1, 0, 0, 20)
        SliderBtn.Position = UDim2.new(0, 0, 0, 24)
        SliderBtn.BackgroundTransparency = 1
        SliderBtn.Text = ""
        SliderBtn.Parent = Frame
        
        local function UpdateSlider(inputPos)
            local pct = math.clamp((inputPos - SliderBg.AbsolutePosition.X) / SliderBg.AbsoluteSize.X, 0, 1)
            local value = min + (max - min) * pct
            if max >= 10 then
                value = math.floor(value)
            else
                value = math.floor(value * 100) / 100
            end
            Fill.Size = UDim2.new(pct, 0, 1, 0)
            Value.Text = tostring(value)
            callback(value)
        end
        
        SliderBtn.InputBegan:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
                dragging = true
                UpdateSlider(input.Position.X)
            end
        end)
        
        SliderBtn.InputEnded:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
                dragging = false
            end
        end)
        
        Connections["Slider_" .. label] = UserInputService.InputChanged:Connect(function(input)
            if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
                UpdateSlider(input.Position.X)
            end
        end)
        
        return Frame
    end
    
    local function CreateSection(parent, text, layoutOrder)
        local Section = Instance.new("TextLabel")
        Section.Size = UDim2.new(1, 0, 0, 24)
        Section.BackgroundTransparency = 1
        Section.Text = text
        Section.TextSize = 11
        Section.Font = Enum.Font.GothamBold
        Section.TextColor3 = Accent
        Section.LayoutOrder = layoutOrder or 0
        Section.Parent = parent
        return Section
    end
    
    local ESP_Panel = TabPanels["ESP"]
    CreateSection(ESP_Panel, "VISUALS", 1)
    CreateToggle(ESP_Panel, "ESP Enabled", Config.ESP_Enabled, function(v) Config.ESP_Enabled = v end, 2)
    CreateToggle(ESP_Panel, "Box", Config.ESP_Box, function(v) Config.ESP_Box = v end, 3)
    CreateToggle(ESP_Panel, "Name", Config.ESP_Name, function(v) Config.ESP_Name = v end, 4)
    CreateToggle(ESP_Panel, "Health Bar", Config.ESP_Health, function(v) Config.ESP_Health = v end, 5)
    CreateToggle(ESP_Panel, "Distance", Config.ESP_Distance, function(v) Config.ESP_Distance = v end, 6)
    CreateToggle(ESP_Panel, "Chams", Config.CHAMS_Enabled, function(v) 
        Config.CHAMS_Enabled = v 
        if not v then Chams.ClearAll() end
    end, 7)
    CreateSlider(ESP_Panel, "Chams Fill", 0, 1, Config.CHAMS_FillTransparency, function(v) Config.CHAMS_FillTransparency = v end, 8)
    CreateToggle(ESP_Panel, "Drone ESP", Config.DRONE_ESP, function(v) 
        Config.DRONE_ESP = v 
        if not v then DroneESP.ClearAll() end
    end, 9)
    CreateSlider(ESP_Panel, "Max Distance", 100, 1500, Config.ESP_MaxDistance, function(v) Config.ESP_MaxDistance = v end, 10)
    
    ESP_Panel.CanvasSize = UDim2.new(0, 0, 0, 550)
    
    local AIM_Panel = TabPanels["Aimbot"]
    CreateSection(AIM_Panel, "TARGETING", 1)
    CreateToggle(AIM_Panel, "Aimbot Enabled", Config.AIM_Enabled, function(v) 
        Config.AIM_Enabled = v 
        FOVCircle.Visible = Config.AIM_ShowFOV and v
    end, 2)
    CreateToggle(AIM_Panel, "Show FOV Circle", Config.AIM_ShowFOV, function(v) 
        Config.AIM_ShowFOV = v 
        FOVCircle.Visible = v and Config.AIM_Enabled
    end, 3)
    CreateToggle(AIM_Panel, "Prediction", Config.AIM_Prediction, function(v) Config.AIM_Prediction = v end, 4)
    CreateSlider(AIM_Panel, "FOV Size", 50, 300, Config.AIM_FOV, function(v) 
        Config.AIM_FOV = v 
        FOVCircle.Radius = v
    end, 5)
    CreateSlider(AIM_Panel, "Smoothness", 0.05, 0.3, Config.AIM_Smooth, function(v) Config.AIM_Smooth = v end, 6)
    CreateSlider(AIM_Panel, "Prediction Amount", 0.5, 1.5, Config.AIM_PredictionAmount, function(v) Config.AIM_PredictionAmount = v end, 7)
    
    CreateSection(AIM_Panel, "RECOIL CONTROL", 9)
    CreateToggle(AIM_Panel, "Anti-Recoil", Config.RECOIL_Enabled, function(v) Config.RECOIL_Enabled = v end, 10)
    CreateSlider(AIM_Panel, "Recoil Strength", 0.5, 3.0, Config.RECOIL_Strength, function(v) Config.RECOIL_Strength = v end, 11)
    CreateToggle(AIM_Panel, "No Camera Shake", Config.NO_CAMSHAKE, function(v) Config.NO_CAMSHAKE = v end, 12)
    
    AIM_Panel.CanvasSize = UDim2.new(0, 0, 0, 580)
    
    local MISC_Panel = TabPanels["Misc"]
    CreateSection(MISC_Panel, "TELEPORT", 1)
    local _, tpToggleSetter = CreateToggle(MISC_Panel, "TP KILL ALL [T]", Config.TP_Enabled, function(v) Config.TP_Enabled = v end, 2)
    CreateSlider(MISC_Panel, "TP Distance", 3, 15, Config.TP_Distance, function(v) Config.TP_Distance = v end, 3)
    CreateToggle(MISC_Panel, "Auto-Shoot", Config.TP_AutoShoot, function(v) Config.TP_AutoShoot = v end, 4)
    
    CreateSection(MISC_Panel, "SPAWN FILTER", 5)
    CreateToggle(MISC_Panel, "Hide Spawn Players", Config.ESP_HideSpawn, function(v) Config.ESP_HideSpawn = v end, 6)
    CreateSlider(MISC_Panel, "Spawn Y Threshold", -100, 50, Config.ESP_SpawnY, function(v) Config.ESP_SpawnY = v end, 7)
    
    CreateSection(MISC_Panel, "ACTIONS", 8)
    
    local UnloadBtn = Instance.new("TextButton")
    UnloadBtn.Size = UDim2.new(1, 0, 0, 38)
    UnloadBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50)
    UnloadBtn.BackgroundTransparency = 0.3
    UnloadBtn.BorderSizePixel = 0
    UnloadBtn.Text = "UNLOAD SCRIPT"
    UnloadBtn.TextSize = 13
    UnloadBtn.Font = Enum.Font.GothamBold
    UnloadBtn.TextColor3 = TextPrimary
    UnloadBtn.LayoutOrder = 9
    UnloadBtn.Parent = MISC_Panel
    
    local UnloadCorner = Instance.new("UICorner")
    UnloadCorner.CornerRadius = UDim.new(0, 10)
    UnloadCorner.Parent = UnloadBtn
    
    UnloadBtn.MouseButton1Click:Connect(function()
        Unload()
    end)
    
    MISC_Panel.CanvasSize = UDim2.new(0, 0, 0, 450)
    
    MainContainer.Visible = Config.MenuOpen
    
    local dragging = false
    local dragStart, startPos
    
    local function StartDrag(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            dragStart = input.Position
            startPos = MainContainer.Position
        end
    end
    
    local function StopDrag(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = false
        end
    end
    
    TopBar.InputBegan:Connect(StartDrag)
    TopBar.InputEnded:Connect(StopDrag)
    
    Connections["Drag"] = UserInputService.InputChanged:Connect(function(input)
        if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
            local delta = input.Position - dragStart
            MainContainer.Position = UDim2.new(
                startPos.X.Scale, startPos.X.Offset + delta.X,
                startPos.Y.Scale, startPos.Y.Offset + delta.Y
            )
        end
    end)
    
    if isMobile then
        local MobileToggle = Instance.new("TextButton")
        MobileToggle.Name = "MobileToggle"
        MobileToggle.Size = UDim2.new(0, 44, 0, 44)
        MobileToggle.Position = UDim2.new(1, -54, 0, 50)
        MobileToggle.BackgroundColor3 = GlassBg
        MobileToggle.BackgroundTransparency = 0.1
        MobileToggle.BorderSizePixel = 0
        MobileToggle.Text = "☰"
        MobileToggle.TextSize = 20
        MobileToggle.Font = Enum.Font.GothamBold
        MobileToggle.TextColor3 = TextPrimary
        MobileToggle.Parent = ScreenGui
        
        local MobileCorner = Instance.new("UICorner")
        MobileCorner.CornerRadius = UDim.new(1, 0)
        MobileCorner.Parent = MobileToggle
        
        local MobileStroke = Instance.new("UIStroke")
        MobileStroke.Color = Accent
        MobileStroke.Thickness = 2
        MobileStroke.Parent = MobileToggle
        
        local visible = true
        local mobileDragging = false
        local mobileDragStart, mobileStartPos
        
        MobileToggle.MouseButton1Click:Connect(function()
            if not mobileDragging then
                visible = not visible
                MainContainer.Visible = visible
            end
        end)
        
        MobileToggle.InputBegan:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.Touch then
                mobileDragging = false
                mobileDragStart = input.Position
                mobileStartPos = MobileToggle.Position
            end
        end)
        
        MobileToggle.InputChanged:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.Touch then
                local delta = input.Position - mobileDragStart
                if delta.Magnitude > 10 then
                    mobileDragging = true
                    local screenSize = ScreenGui.AbsoluteSize
                    local btnSize = MobileToggle.AbsoluteSize
                    local newX = math.clamp(mobileStartPos.X.Offset + delta.X, 10, screenSize.X - btnSize.X - 10)
                    local newY = math.clamp(mobileStartPos.Y.Offset + delta.Y, 50, screenSize.Y - btnSize.Y - 10)
                    MobileToggle.Position = UDim2.new(0, newX, 0, newY)
                end
            end
        end)
        
        MobileToggle.InputEnded:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.Touch then
                task.wait(0.1)
                mobileDragging = false
            end
        end)
        
        MobileTPBtn = Instance.new("TextButton")
        MobileTPBtn.Name = "MobileTP"
        MobileTPBtn.Size = UDim2.new(0, 56, 0, 56)
        MobileTPBtn.Position = UDim2.new(1, -70, 1, -140)
        MobileTPBtn.BackgroundColor3 = Color3.fromRGB(60, 65, 75)
        MobileTPBtn.BackgroundTransparency = 0.2
        MobileTPBtn.BorderSizePixel = 0
        MobileTPBtn.Text = "TP"
        MobileTPBtn.TextSize = 16
        MobileTPBtn.Font = Enum.Font.GothamBold
        MobileTPBtn.TextColor3 = TextPrimary
        MobileTPBtn.Visible = Config.TP_Enabled
        MobileTPBtn.Parent = ScreenGui
        
        local TPCorner = Instance.new("UICorner")
        TPCorner.CornerRadius = UDim.new(1, 0)
        TPCorner.Parent = MobileTPBtn
        
        local TPStroke = Instance.new("UIStroke")
        TPStroke.Color = Accent
        TPStroke.Thickness = 2
        TPStroke.Parent = MobileTPBtn
        
        local tpDragging = false
        local tpDragStart, tpStartPos
        
        MobileTPBtn.MouseButton1Click:Connect(function()
            if not tpDragging then
                TPActive = not TPActive
                
                if TPActive then
                    TPTarget = GetClosestEnemy()
                    TPShotCount = 0
                    TPMagSize = GetMagSize()
                    MobileTPBtn.BackgroundColor3 = Accent
                    MobileTPBtn.Text = "ON"
                else
                    TPTarget = nil
                    MobileTPBtn.BackgroundColor3 = Color3.fromRGB(60, 65, 75)
                    MobileTPBtn.Text = "TP"
                end
            end
        end)
        
        MobileTPBtn.InputBegan:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.Touch then
                tpDragging = false
                tpDragStart = input.Position
                tpStartPos = MobileTPBtn.Position
            end
        end)
        
        MobileTPBtn.InputChanged:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.Touch then
                local delta = input.Position - tpDragStart
                if delta.Magnitude > 10 then
                    tpDragging = true
                    local screenSize = ScreenGui.AbsoluteSize
                    local btnSize = MobileTPBtn.AbsoluteSize
                    local newX = math.clamp(tpStartPos.X.Offset + delta.X, 10, screenSize.X - btnSize.X - 10)
                    local newY = math.clamp(tpStartPos.Y.Offset + delta.Y, 50, screenSize.Y - btnSize.Y - 10)
                    MobileTPBtn.Position = UDim2.new(0, newX, 0, newY)
                end
            end
        end)
        
        MobileTPBtn.InputEnded:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.Touch then
                task.wait(0.1)
                tpDragging = false
            end
        end)
    end
    
    return ScreenGui, MainContainer
end

Unload = function()
    if State.Unloaded then return end
    State.Unloaded = true
    
    Config.TP_Enabled = false
    TPActive = false
    
    for _, conn in pairs(Connections) do
        pcall(function() conn:Disconnect() end)
    end
    Connections = {}
    
    for player, esp in pairs(ESP.cache) do
        ESP.Hide(esp)
        ESP.Destroy(esp)
    end
    ESP.cache = {}
    
    Chams.ClearAll()
    DroneESP.ClearAll()
    
    pcall(function() FOVCircle:Remove() end)
    
    if ScreenGui then
        pcall(function() ScreenGui:Destroy() end)
        ScreenGui = nil
    end
    
    pcall(function()
        local gui = game:GetService("CoreGui"):FindFirstChild("WarfareESP")
        if gui then gui:Destroy() end
    end)
    pcall(function()
        local gui = LocalPlayer.PlayerGui:FindFirstChild("WarfareESP")
        if gui then gui:Destroy() end
    end)
    
    State.PatchedTables = {}
    State.RecoilModulesPatched = false
    
    getgenv().WarfareESP = nil
end

local function UpdateMobileTPButton()
    if MobileTPBtn then
        MobileTPBtn.Visible = Config.TP_Enabled
        if not Config.TP_Enabled then
            TPActive = false
            MobileTPBtn.BackgroundColor3 = Color3.fromRGB(60, 65, 75)
            MobileTPBtn.Text = "TP"
        end
        if TPActive then
            MobileTPBtn.BackgroundColor3 = Color3.fromRGB(220, 60, 60)
            MobileTPBtn.Text = "ON"
        else
            MobileTPBtn.BackgroundColor3 = Color3.fromRGB(60, 65, 75)
            MobileTPBtn.Text = "TP"
        end
    end
end

local function Init()
    local gui, mainFrame = CreateMenu()
    
    Connections.Render = RunService.RenderStepped:Connect(function()
        MainLoop()
        UpdateMobileTPButton()
    end)
    
    Connections.PlayerRemoving = Players.PlayerRemoving:Connect(function(player)
        ESP.Remove(player)
        VisibilityCache[player] = nil
        local char = player.Character
        if char then Chams.Remove(char) end
    end)
    
    Connections.CharacterAdded = LocalPlayer.CharacterAdded:Connect(function(char)
        State.RecoilModulesPatched = false
        State.ShotsFired = 0
        State.IsFiring = false
    end)
    
    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer then
            player.CharacterAdded:Connect(function(char)
                ESP.Remove(player)
                Chams.Remove(player.Character)
            end)
        end
    end
    
    Connections.PlayerAdded = Players.PlayerAdded:Connect(function(player)
        player.CharacterAdded:Connect(function(char)
            ESP.Remove(player)
        end)
    end)
    
    Connections.Input = UserInputService.InputBegan:Connect(function(input, processed)
        if processed then return end
        
        if input.KeyCode == Config.MenuKey or input.KeyCode == Enum.KeyCode.RightShift then
            Config.MenuOpen = not Config.MenuOpen
            mainFrame.Visible = Config.MenuOpen
        end
        
        if input.KeyCode == Enum.KeyCode.End then
            Unload()
        end
    end)
end

Init()

getgenv().WarfareESP = {
    Config = Config,
    Unload = Unload,
    State = State
}

Features & Information

Open source tested on xeno desktop THIS GAME MAY NOT OFFER MOBILE VERSION AT ALL, SCRIPT DOES HAVE MOBILE COMPATIBILITY BUT THE GAME ITSELF MIGHT NOT. Features: TP Kill All (+ Auto Reload) Predictive Aimbot Recoil (Every gun mapped) ESP Chams Drone ESP Shift to hide/show ui T to teleport / kill ALL (toggle)
#aimbot#kill all#warfare#esp#source

Community Comments (3)

leetleetJan 16, 2026

This script was bugged it is now visible.

tester674109tester674109Jul 18, 2026

aimbot not working

LonokrakenLonokrakenAug 26, 2026

hey, on the map that is pretty much just a straight line doesnt work.

More Scripts for Warfare