--[[
	WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your risk!
    Integrated Features: Auto Dig (Prioritized), CFrame Speed, ESP, KillAura, etc.
    Update v7.3: Added "Thumb-Friendly" Borders. The UI has thick empty margins on sides/bottom for easy dragging.
]]
-- Version: 7.3 (Big Grip Borders for Mobile)

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local ContextActionService = game:GetService("ContextActionService")
local VirtualInputManager = game:GetService("VirtualInputManager")
local UserInputService = game:GetService("UserInputService")
local Stats = game:GetService("Stats")

--==================================================================================--
--            NOCLIP FUNCTIONALITY                                                  --
--==================================================================================--

local Noclip = nil
local Clip = nil
local noclipEnabled = false
local floatName = "FloatPart"

function noclip()
	Clip = false
	local function Nocl()
		if Clip == false and game.Players.LocalPlayer.Character ~= nil then
			for _,v in pairs(game.Players.LocalPlayer.Character:GetDescendants()) do
				if v:IsA('BasePart') and v.CanCollide and v.Name ~= floatName then
					v.CanCollide = false
				end
			end
		end
		task.wait(0.21)
	end
	Noclip = game:GetService('RunService').Stepped:Connect(Nocl)
end

function clip()
	if Noclip then 
		Noclip:Disconnect() 
	end
	Clip = true

	if game.Players.LocalPlayer.Character ~= nil then
		local torso = game.Players.LocalPlayer.Character:FindFirstChild("Torso")
		if torso and torso:IsA('BasePart') then
			torso.CanCollide = true
		end
	end
end

local function reapplyNoclipIfEnabled()
	if noclipEnabled then
		task.wait(0.1)
		noclip()
	end
end

--==================================================================================--
--            SPEED HACK FUNCTIONALITY (CFRAME METHOD)                              --
--==================================================================================--

local speedHackEnabled = false
local speedValue = 10 -- Default speed
local minSpeed = 1   -- Base walkspeed approx
local maxSpeed = 30  -- Max slider speed

RunService.Heartbeat:Connect(function(deltaTime)
    if speedHackEnabled and LocalPlayer.Character then
        local humanoid = LocalPlayer.Character:FindFirstChild("Humanoid")
        local rootPart = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")

        if humanoid and rootPart and humanoid.Health > 0 then
            local moveDir = humanoid.MoveDirection
            if moveDir.Magnitude > 0 then
                rootPart.CFrame = rootPart.CFrame + (moveDir * (speedValue * deltaTime))
            end
        end
    end
end)

--==================================================================================--
--            AUTO DIG FUNCTIONALITY                                                --
--==================================================================================--

local autoDigEnabled = false
local digDelay = 0.1 
local digRadius = 20 

local overlapParams = OverlapParams.new()
overlapParams.FilterType = Enum.RaycastFilterType.Exclude
overlapParams.MaxParts = 99999 

local function findClosestBlock()
    local char = LocalPlayer.Character
    local root = char and char:FindFirstChild("HumanoidRootPart")
    if not root then return nil end

    overlapParams.FilterDescendantsInstances = {char}

    local parts = workspace:GetPartBoundsInRadius(root.Position, digRadius, overlapParams)

    local closestBlock = nil
    local shortestDistance = math.huge 

    for _, part in ipairs(parts) do
        if part.Parent and part.Parent.Name == "Blocks" and part:IsA("BasePart") then
            local dist = (root.Position - part.Position).Magnitude
            if dist < shortestDistance then
                shortestDistance = dist
                closestBlock = part
            end
        end
    end

    return closestBlock
end

local function digBlock(blockPosition)
    local event = ReplicatedStorage:FindFirstChild("ServerEvents")
    local digRemote = event and event:FindFirstChild("Dig")
    if digRemote then
        digRemote:FireServer(blockPosition)
    end
end

task.spawn(function()
    while task.wait(digDelay) do
        if autoDigEnabled then
            local target = findClosestBlock()
            if target then
                digBlock(target.Position)
            end
        end
    end
end)

--==================================================================================--
--            VOTEKICK REMOVAL                                                      --
--==================================================================================--

pcall(function()
    local voteKickEvent = ReplicatedStorage:WaitForChild("ServerEvents", 5) and ReplicatedStorage.ServerEvents:FindFirstChild("VoteKick")
    if voteKickEvent then
        voteKickEvent:Destroy()
    end
end)

--==================================================================================--
--            KILLAURA FUNCTIONALITY                                                --
--==================================================================================--

local killAuraEnabled = true 
local killAuraStateBeforeAutoDig = nil

local function findClosestPlayer()
    if not (LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")) then
        return nil
    end

    local myPosition = LocalPlayer.Character.HumanoidRootPart.Position
    local closestPlayer = nil
    local shortestDistance = math.huge

    for _, player in ipairs(Players:GetPlayers()) do
        if player ~= LocalPlayer then
            local character = player.Character
            if character and character:FindFirstChild("HumanoidRootPart") then
                local distance = (myPosition - character.HumanoidRootPart.Position).magnitude
                if distance < shortestDistance then
                    shortestDistance = distance
                    closestPlayer = player
                end
            end
        end
    end

    return closestPlayer
end

task.spawn(function()
    while task.wait() do
        if killAuraEnabled and not autoDigEnabled then
            local closestPlayer = findClosestPlayer()
            if closestPlayer and closestPlayer.Character and closestPlayer.Character:FindFirstChild("Humanoid") and closestPlayer.Character:FindFirstChild("BiteHitbox") and closestPlayer.Character.Humanoid.Health > 0 then
                local args = {
                    [1] = "Bite",
                    [2] = closestPlayer.Character.Humanoid,
                    [3] = closestPlayer.Character.BiteHitbox
                }
                pcall(function()
                    ReplicatedStorage.ServerEvents.Bite:FireServer(unpack(args))
                end)
            end
        end
    end
end)


--==================================================================================--
--            HITBOX EXPANDER FUNCTIONALITY                                         --
--==================================================================================--

_G.TeamCheck = true

RunService.RenderStepped:Connect(function()
    if not _G.Disabled then
        for _, player in ipairs(Players:GetPlayers()) do
            if player ~= LocalPlayer then
                local character = player.Character
                if character then
                    pcall(function()
                        local part = character:FindFirstChild("BiteHitbox")
                        if part then
                            if _G.TeamCheck and player.Team and player.Team == LocalPlayer.Team then
                                part.Size = Vector3.new(1, 1, 1)
                            else
                                part.Size = Vector3.new(25, 25, 25)
                                part.Transparency = 1
                                part.BrickColor = BrickColor.new("Royal purple")
                                part.Material = Enum.Material.Neon
                                part.CanCollide = false
                                part.Massless = true
                            end
                        end
                    end)
                end
            end
        end
    end
end)

--==================================================================================--
--            ESP FUNCTIONALITY                                                     --
--==================================================================================--

local ESP_TEXT_SIZE = 20
local ESP_COLOR = Color3.new(1, 1, 1)
local espEnabled = true
local espTeamCheck = true

local espLabels = {}

local function getEspVisibility(player)
    if not espEnabled then return false end
    if espTeamCheck then
        if player.Team and player.Team == LocalPlayer.Team then
            return false
        end
    end
    return true
end

local function updateAllESPViz()
    for player, billboardGui in pairs(espLabels) do
        if billboardGui and billboardGui.Parent then
            billboardGui.Enabled = getEspVisibility(player)
            local infoLabel = billboardGui:FindFirstChild("ESPInfoText")
            if infoLabel then
                 local teamColor = player.Team and player.Team.TeamColor.Color or Color3.new(1, 1, 1)
                 infoLabel.TextColor3 = teamColor
            end
        end
    end
end

local function getFormattedText(character, username)
    local humanoidRootPart = character:WaitForChild("HumanoidRootPart", 5)
    if not humanoidRootPart then return username end

    local class = character:GetAttribute("Class")
    local class2 = character:GetAttribute("Class2")
    local size = character:GetAttribute("Size")

    local infoParts = {}
    if size then table.insert(infoParts, tostring(size)) end
    if class then table.insert(infoParts, tostring(class)) end
    if class2 then table.insert(infoParts, tostring(class2)) end

    local infoText = #infoParts > 0 and "(" .. table.concat(infoParts, " / ") .. ")" or ""
    return username .. " " .. infoText
end

local function createESP(player)
    if player == LocalPlayer then return end

    local character = player.Character or player.CharacterAdded:Wait()
    local humanoid = character:WaitForChild("Humanoid")
    local humanoidRootPart = character:WaitForChild("HumanoidRootPart")

    if espLabels[player] then
        espLabels[player]:Destroy()
        espLabels[player] = nil
    end

    local billboardGui = Instance.new("BillboardGui")
    billboardGui.Name = "ESP"
    billboardGui.Parent = humanoidRootPart
    billboardGui.Size = UDim2.new(0, 200, 0, 70) 
    billboardGui.StudsOffset = Vector3.new(0, 3, 0) 
    billboardGui.AlwaysOnTop = true

    local listLayout = Instance.new("UIListLayout")
    listLayout.Parent = billboardGui
    listLayout.SortOrder = Enum.SortOrder.LayoutOrder
    listLayout.Padding = UDim.new(0, 5) 

    local infoLabel = Instance.new("TextLabel")
    infoLabel.Name = "ESPInfoText"
    infoLabel.Parent = billboardGui
    infoLabel.LayoutOrder = 1 
    infoLabel.Size = UDim2.new(1, 0, 0, ESP_TEXT_SIZE)
    infoLabel.BackgroundTransparency = 1
    infoLabel.Text = getFormattedText(character, player.Name)
    infoLabel.TextColor3 = ESP_COLOR
    infoLabel.TextSize = ESP_TEXT_SIZE
    infoLabel.Font = Enum.Font.SourceSansBold
    infoLabel.TextStrokeTransparency = 0
    infoLabel.TextStrokeColor3 = Color3.new(0, 0, 0)

    local healthLabel = Instance.new("TextLabel")
    healthLabel.Name = "ESPHealthText"
    healthLabel.Parent = billboardGui
    healthLabel.LayoutOrder = 2 
    local healthTextSize = ESP_TEXT_SIZE - 2 
    healthLabel.Size = UDim2.new(1, 0, 0, healthTextSize)
    healthLabel.BackgroundTransparency = 1
    healthLabel.Text = "100 HP" 
    healthLabel.Font = Enum.Font.SourceSansBold
    healthLabel.TextSize = healthTextSize
    healthLabel.TextColor3 = Color3.fromRGB(85, 255, 85) 
    healthLabel.TextStrokeTransparency = 1 

    espLabels[player] = billboardGui

    local connections = {}

    local function updateHealthDisplay()
        if not humanoid or not healthLabel or not healthLabel.Parent then return end
        local health = humanoid.Health
        healthLabel.Text = math.floor(health) .. " HP"
        if health > 50 then
            healthLabel.TextColor3 = Color3.fromRGB(85, 255, 85)
        else
            healthLabel.TextColor3 = Color3.fromRGB(255, 85, 85)
        end
    end

    local function updateColorAndViz()
        local teamColor = player.Team and player.Team.TeamColor.Color or Color3.new(1, 1, 1)
        infoLabel.TextColor3 = teamColor
        billboardGui.Enabled = getEspVisibility(player)
    end

    local function connectAttributeChange(attrName)
        if character.GetAttributeChangedSignal then
            table.insert(connections, character:GetAttributeChangedSignal(attrName):Connect(function()
                if infoLabel and infoLabel.Parent then
                    infoLabel.Text = getFormattedText(character, player.Name)
                end
            end))
        end
    end
    connectAttributeChange("Class")
    connectAttributeChange("Class2")
    connectAttributeChange("Size")

    table.insert(connections, player:GetPropertyChangedSignal("Team"):Connect(updateColorAndViz))
    table.insert(connections, humanoid.HealthChanged:Connect(updateHealthDisplay))

    updateColorAndViz()
    updateHealthDisplay()

    local respawnConnection
    respawnConnection = player.CharacterAdded:Connect(function(newCharacter)
        if billboardGui then billboardGui:Destroy() end
        for _, conn in ipairs(connections) do conn:Disconnect() end
        if espLabels[player] then espLabels[player] = nil end
        if respawnConnection then respawnConnection:Disconnect() end
        task.wait(0.1)
        createESP(player)
    end)

    local leaveConnection
    leaveConnection = player.AncestryChanged:Connect(function()
        if not player.Parent then
            if billboardGui then billboardGui:Destroy() end
            for _, conn in ipairs(connections) do conn:Disconnect() end
            if respawnConnection then respawnConnection:Disconnect() end
            if leaveConnection then leaveConnection:Disconnect() end
            espLabels[player] = nil
        end
    end)
end

for _, player in ipairs(Players:GetPlayers()) do
    if player ~= LocalPlayer and player.Character then
        spawn(function() createESP(player) end)
    end
    if player ~= LocalPlayer then
        player.CharacterAdded:Connect(function() createESP(player) end)
    end
end

Players.PlayerAdded:Connect(function(player)
    if player ~= LocalPlayer then
        player.CharacterAdded:Connect(function() createESP(player) end)
    end
end)

LocalPlayer:GetPropertyChangedSignal("Team"):Connect(updateAllESPViz)

--==================================================================================--
--            TUTORIAL POPUP GUI                                                    --
--==================================================================================--

local tutorialGui = Instance.new("ScreenGui")
tutorialGui.Name = "TutorialGui"
tutorialGui.ResetOnSpawn = false
tutorialGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
tutorialGui.DisplayOrder = 999

local blurEffect = Instance.new("Frame")
blurEffect.Name = "Blur"
blurEffect.Size = UDim2.fromScale(1, 1)
blurEffect.BackgroundColor3 = Color3.new(0, 0, 0)
blurEffect.BackgroundTransparency = 0.3
blurEffect.BorderSizePixel = 0
blurEffect.Parent = tutorialGui

local tutorialFrame = Instance.new("Frame")
tutorialFrame.Name = "TutorialFrame"
tutorialFrame.AnchorPoint = Vector2.new(0.5, 0.5)
tutorialFrame.Position = UDim2.fromScale(0.5, 0.5)
tutorialFrame.Size = UDim2.fromScale(0.9, 0.8) 
tutorialFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 40)
tutorialFrame.BorderSizePixel = 3
tutorialFrame.BorderColor3 = Color3.fromRGB(100, 100, 255)
tutorialFrame.Parent = tutorialGui

local tutorialTitle = Instance.new("TextLabel")
tutorialTitle.Name = "Title"
tutorialTitle.Size = UDim2.new(1, 0, 0, 50)
tutorialTitle.BackgroundColor3 = Color3.fromRGB(50, 50, 200)
tutorialTitle.BorderSizePixel = 0
tutorialTitle.Text = "Script Tutorial & Hotkeys"
tutorialTitle.TextColor3 = Color3.new(1, 1, 1)
tutorialTitle.Font = Enum.Font.SourceSansBold
tutorialTitle.TextScaled = true
tutorialTitle.Parent = tutorialFrame

local scrollFrame = Instance.new("ScrollingFrame")
scrollFrame.Name = "ScrollFrame"
scrollFrame.Position = UDim2.new(0, 10, 0, 60)
scrollFrame.Size = UDim2.new(1, -20, 1, -120)
scrollFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 30)
scrollFrame.BorderSizePixel = 0
scrollFrame.ScrollBarThickness = 8
scrollFrame.CanvasSize = UDim2.fromOffset(0, 1050)
scrollFrame.Parent = tutorialFrame

local contentText = Instance.new("TextLabel")
contentText.Name = "Content"
contentText.Size = UDim2.new(1, -10, 0, 1000)
contentText.Position = UDim2.fromOffset(5, 5)
contentText.BackgroundTransparency = 1
contentText.TextColor3 = Color3.new(1, 1, 1)
contentText.Font = Enum.Font.SourceSans
contentText.TextSize = 16
contentText.TextWrapped = true
contentText.TextXAlignment = Enum.TextXAlignment.Left
contentText.TextYAlignment = Enum.TextYAlignment.Top
contentText.Parent = scrollFrame

contentText.Text = [[
HOTKEYS:
────────────────────────────
β€’ Q - Toggle Auto Acid ON/OFF
β€’ G - Toggle Auto Walk ON/OFF

────────────────────────────
FEATURES & MODES:
────────────────────────────

1. AUTO ACID (Q to toggle OR click button)
   Automatically uses acid ability on nearest enemy within 30 studs.
   Works when your ability is ready and an enemy is in range.

2. AUTO DIG (Click button to toggle)
   Automatically digs nearby blocks.
   **NOTE:** When enabled, this will automatically disable Kill Aura to prevent conflicts.

3. AUTO WALK (G to toggle)
   Holds W key automatically for continuous forward movement.
   Press W manually to turn it off.

4. KILLAURA (Click button to toggle)
   Default: ON
   Automatically bites the closest player to you.
   **NOTE:** Will be greyed out if Auto Dig is enabled.

5. SPEED HACK (Slider & Toggle)
   Adjust slider to change speed.
   Uses CFrame manipulation (works while attacking).

6. LEGIT MODE (Click button to toggle)
   Default: OFF
   When ON, presses F key before using acid ability.
   Makes the auto acid feature look more legitimate.

7. NOCLIP (Click button to toggle)
   Default: OFF
   Walk through walls and obstacles.

8. ESP (Click button to toggle)
   Default: ON
   Shows player names, class, size, and health.
   Color changes based on team.

────────────────────────────
ADDITIONAL INFO:
────────────────────────────

β€’ UI is draggable and minimizable for mobile!
β€’ Drag using the THICK BORDERS on the sides and bottom.
β€’ Click minimize button to collapse
β€’ Votekick is automatically disabled
β€’ Hitbox expander runs automatically (25x25x25)

────────────────────────────
Click CLOSE to start using the script!
]]

local closeTutorialButton = Instance.new("TextButton")
closeTutorialButton.Name = "CloseButton"
closeTutorialButton.AnchorPoint = Vector2.new(0.5, 0)
closeTutorialButton.Position = UDim2.new(0.5, 0, 1, -50)
closeTutorialButton.Size = UDim2.fromOffset(150, 40)
closeTutorialButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
closeTutorialButton.BorderSizePixel = 0
closeTutorialButton.Text = "CLOSE"
closeTutorialButton.TextColor3 = Color3.new(1, 1, 1)
closeTutorialButton.Font = Enum.Font.SourceSansBold
closeTutorialButton.TextSize = 20
closeTutorialButton.Parent = tutorialFrame

closeTutorialButton.MouseButton1Click:Connect(function()
    tutorialGui:Destroy()
end)

--==================================================================================--
--            GUI SETUP (MOBILE-FRIENDLY DRAGGABLE UI)                              --
--==================================================================================--

local playerGui = LocalPlayer:WaitForChild("PlayerGui")
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")

local isSystemActive = false
local isAutoWalkEnabled = false
local legitMode = false

local ACTION_TOGGLE_SYSTEM = "ToggleSystemAction"
local ACTION_TOGGLE_AUTOWALK = "ToggleAutoWalkAction"

local ACTIVATION_DISTANCE = 30

local abilityChangedConnection = nil
local childAddedConnection = nil
local childRemovedConnection = nil
local manualWKeyUpConnection = nil

local statusGui = Instance.new("ScreenGui")
statusGui.Name = "SystemStatusGui"
statusGui.ResetOnSpawn = false
statusGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
statusGui.DisplayOrder = 998

-- Main container frame (draggable and minimizable)
local mainContainer = Instance.new("Frame")
mainContainer.Name = "MainContainer"
mainContainer.AnchorPoint = Vector2.new(0, 0)  
mainContainer.Position = UDim2.new(0.5, -180, 0.5, -280)  -- Centered
-- INCREASED SIZE to create "Grips" (360 wide, 560 high)
mainContainer.Size = UDim2.fromOffset(360, 560) 
mainContainer.BackgroundColor3 = Color3.fromRGB(25, 25, 30)
mainContainer.BorderSizePixel = 2
mainContainer.BorderColor3 = Color3.fromRGB(100, 100, 255)
mainContainer.Parent = statusGui

-- Title bar for dragging
local titleBar = Instance.new("Frame")
titleBar.Name = "TitleBar"
titleBar.Size = UDim2.new(1, 0, 0, 35)
titleBar.BackgroundColor3 = Color3.fromRGB(50, 50, 200)
titleBar.BorderSizePixel = 0
titleBar.Parent = mainContainer

local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(1, -70, 1, 0)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "Ant War Script v7.3"
titleLabel.TextColor3 = Color3.new(1, 1, 1)
titleLabel.Font = Enum.Font.SourceSansBold
titleLabel.TextSize = 18
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Position = UDim2.fromOffset(10, 0)
titleLabel.Parent = titleBar

-- Minimize button
local minimizeButton = Instance.new("TextButton")
minimizeButton.Name = "MinimizeButton"
minimizeButton.Size = UDim2.fromOffset(60, 30)
minimizeButton.Position = UDim2.new(1, -65, 0, 2.5)
minimizeButton.BackgroundColor3 = Color3.fromRGB(70, 70, 180)
minimizeButton.BorderSizePixel = 0
minimizeButton.Text = "βˆ’"
minimizeButton.TextColor3 = Color3.new(1, 1, 1)
minimizeButton.Font = Enum.Font.SourceSansBold
minimizeButton.TextSize = 24
minimizeButton.Parent = titleBar

-- Content frame (holds all buttons)
local contentFrame = Instance.new("Frame")
contentFrame.Name = "ContentFrame"
-- MODIFIED POSITION/SIZE FOR THICK GRIP BORDERS
-- Left Padding: 30px | Right Padding: 30px | Bottom Padding: 40px
contentFrame.Position = UDim2.new(0, 30, 0, 35) -- Start 30px in
contentFrame.Size = UDim2.new(1, -60, 1, -75) -- Width -60 (30 each side), Height -75 (35 top + 40 bottom)
contentFrame.BackgroundTransparency = 1
contentFrame.Parent = mainContainer

local uiListLayout = Instance.new("UIListLayout")
uiListLayout.SortOrder = Enum.SortOrder.LayoutOrder
uiListLayout.Padding = UDim.new(0, 5)
uiListLayout.Parent = contentFrame

-- Dragging functionality (UPDATED for Massive Borders)
local dragging = false
local dragInput, dragStart, startPos

local function update(input)
    local delta = input.Position - dragStart
    local newPos = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
    mainContainer.Position = newPos
end

local function makeDraggable(guiObject)
    guiObject.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            dragStart = input.Position
            startPos = mainContainer.Position

            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    dragging = false
                end
            end)
        end
    end)

    guiObject.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
            dragInput = input
        end
    end)
end

makeDraggable(titleBar)
makeDraggable(mainContainer) -- Touching anywhere on the background (the thick borders) starts dragging

UserInputService.InputChanged:Connect(function(input)
    if input == dragInput and dragging then
        update(input)
    end
end)


-- Minimize functionality
local isMinimized = false
local originalSize = UDim2.fromOffset(360, 560)
local minimizedSize = UDim2.fromOffset(360, 35)

minimizeButton.MouseButton1Click:Connect(function()
    local savedPos = mainContainer.Position
    
    isMinimized = not isMinimized
    
    if isMinimized then
        mainContainer.Size = minimizedSize
        minimizeButton.Text = "+"
        contentFrame.Visible = false
    else
        mainContainer.Size = originalSize
        minimizeButton.Text = "βˆ’"
        contentFrame.Visible = true
    end
    mainContainer.Position = savedPos
end)


-- Helper function to create mobile-friendly button frames
local layoutOrder = 0
local function createMobileButton(name, text, defaultColor)
    local btn = Instance.new("TextButton")
    btn.Name = name
    btn.Size = UDim2.new(1, 0, 0, 40) 
    btn.BackgroundColor3 = defaultColor or Color3.fromRGB(220, 40, 40)
    btn.BorderSizePixel = 2
    btn.BorderColor3 = Color3.fromRGB(80, 80, 80)
    btn.TextColor3 = Color3.new(1, 1, 1)
    btn.Font = Enum.Font.SourceSansBold
    btn.TextSize = 14
    btn.TextScaled = false
    btn.TextWrapped = true
    btn.Text = text
    btn.LayoutOrder = layoutOrder
    btn.Parent = contentFrame
    layoutOrder = layoutOrder + 1
    return btn
end

-- Create buttons
local statusButton = createMobileButton("StatusButton", "Auto Acid: OFF", Color3.fromRGB(220, 40, 40))
local infoButton = createMobileButton("InfoButton", "...", Color3.fromRGB(50, 50, 50))
infoButton.TextSize = 18 
local autoWalkButton = createMobileButton("AutoWalkButton", "Auto Walk: OFF", nil)
local legitModeButton = createMobileButton("LegitModeButton", "Legit Mode: OFF", nil)

-- KillAura and AutoDig Buttons
local killAuraButton = createMobileButton("KillAuraButton", "KillAura: ON", Color3.fromRGB(0, 200, 80))
local autoDigButton = createMobileButton("AutoDigButton", "Auto Dig: OFF", nil)

-- Speed Slider Frame Container
local speedFrame = Instance.new("Frame")
speedFrame.Name = "SpeedFrame"
speedFrame.Size = UDim2.new(1, 0, 0, 90)
speedFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 40)
speedFrame.BorderSizePixel = 2
speedFrame.BorderColor3 = Color3.fromRGB(80, 80, 80)
speedFrame.LayoutOrder = layoutOrder
speedFrame.Parent = contentFrame
layoutOrder = layoutOrder + 1

local speedToggleBtn = Instance.new("TextButton")
speedToggleBtn.Name = "SpeedToggle"
speedToggleBtn.Size = UDim2.new(0, 80, 1, 0)
speedToggleBtn.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
speedToggleBtn.Text = "Speed: OFF"
speedToggleBtn.TextColor3 = Color3.new(1, 1, 1)
speedToggleBtn.Font = Enum.Font.SourceSansBold
speedToggleBtn.TextSize = 14
speedToggleBtn.Parent = speedFrame

local speedSliderBar = Instance.new("Frame")
speedSliderBar.Name = "SliderBar"
speedSliderBar.Size = UDim2.new(1, -100, 0, 12)
speedSliderBar.Position = UDim2.new(0, 90, 0.5, 10) 
speedSliderBar.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
speedSliderBar.BorderSizePixel = 0
speedSliderBar.Parent = speedFrame

local speedSliderBtn = Instance.new("TextButton")
speedSliderBtn.Name = "SliderBtn"
speedSliderBtn.Size = UDim2.new(0, 30, 0, 30)
speedSliderBtn.AnchorPoint = Vector2.new(0.5, 0.5)
speedSliderBtn.Position = UDim2.new(0, 0, 0.5, 0) 
speedSliderBtn.BackgroundColor3 = Color3.fromRGB(200, 200, 200)
speedSliderBtn.Text = ""
speedSliderBtn.Parent = speedSliderBar

local speedLabel = Instance.new("TextLabel")
speedLabel.Name = "SpeedVal"
speedLabel.Size = UDim2.new(1, -100, 0, 25) 
speedLabel.Position = UDim2.new(0, 90, 0, 5)
speedLabel.BackgroundTransparency = 1
speedLabel.Text = "Speed: " .. speedValue
speedLabel.TextColor3 = Color3.new(1, 1, 1)
speedLabel.Font = Enum.Font.SourceSansBold 
speedLabel.TextSize = 16 
speedLabel.Parent = speedFrame

-- Noclip and ESP Buttons
local noclipButton = createMobileButton("NoclipButton", "Noclip: OFF", nil)
local espButton = createMobileButton("ESPButton", "ESP: ON", Color3.fromRGB(0, 200, 80))
local espTeamcheckButton = createMobileButton("ESPTeamcheckButton", "Teamcheck: ON", Color3.fromRGB(0, 200, 80))

-- Show GUIs
tutorialGui.Parent = playerGui
statusGui.Parent = playerGui

--==================================================================================--
--            UI UPDATE FUNCTIONS                                                   --
--==================================================================================--

task.spawn(function()
    while task.wait() do
        if infoButton and infoButton.Parent then
            local playerCount = #Players:GetPlayers()
            local dataPingItem = Stats.Network:FindFirstChild("ServerStatsItem") and Stats.Network.ServerStatsItem:FindFirstChild("Data Ping")
            local ping = dataPingItem and dataPingItem:GetValue() or 0
            infoButton.Text = string.format("%d players / %d ms", playerCount, math.floor(ping))
        else
            break
        end
    end
end)

local function updateStatusUI()
    if isSystemActive then
        statusButton.BackgroundColor3 = Color3.fromRGB(0, 200, 80)
        statusButton.Text = "Auto Acid: ON"
    else
        statusButton.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
        statusButton.Text = "Auto Acid: OFF"
    end
end

local function updateAutoWalkUI()
    if isAutoWalkEnabled then
        autoWalkButton.BackgroundColor3 = Color3.fromRGB(0, 200, 80)
        autoWalkButton.Text = "Auto Walk: ON"
    else
        autoWalkButton.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
        autoWalkButton.Text = "Auto Walk: OFF"
    end
end

local function updateLegitModeUI()
    if legitMode then
        legitModeButton.BackgroundColor3 = Color3.fromRGB(0, 200, 80)
        legitModeButton.Text = "Legit Mode: ON"
    else
        legitModeButton.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
        legitModeButton.Text = "Legit Mode: OFF"
    end
end

-- Kill Aura UI Update
local function updateKillAuraUI()
    if autoDigEnabled then
        killAuraButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
        killAuraButton.Text = "KillAura: BLOCKED\n(AutoDig Active)"
        return
    end

    if killAuraEnabled then
        killAuraButton.BackgroundColor3 = Color3.fromRGB(0, 200, 80)
        killAuraButton.Text = "KillAura: ON"
    else
        killAuraButton.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
        killAuraButton.Text = "KillAura: OFF"
    end
end

local function updateNoclipUI()
    if noclipEnabled then
        noclipButton.BackgroundColor3 = Color3.fromRGB(0, 200, 80)
        noclipButton.Text = "Noclip: ON"
    else
        noclipButton.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
        noclipButton.Text = "Noclip: OFF"
    end
end

local function updateESPUI()
    if espEnabled then
        espButton.BackgroundColor3 = Color3.fromRGB(0, 200, 80)
        espButton.Text = "ESP: ON"
    else
        espButton.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
        espButton.Text = "ESP: OFF"
    end
    updateAllESPViz()
end

local function updateESPTeamcheckUI()
    if espTeamCheck then
        espTeamcheckButton.BackgroundColor3 = Color3.fromRGB(0, 200, 80)
        espTeamcheckButton.Text = "Teamcheck: ON"
    else
        espTeamcheckButton.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
        espTeamcheckButton.Text = "Teamcheck: OFF"
    end
    updateAllESPViz()
end

local function updateAutoDigUI()
    if autoDigEnabled then
        autoDigButton.BackgroundColor3 = Color3.fromRGB(0, 200, 80)
        autoDigButton.Text = "Auto Dig: ON"
    else
        autoDigButton.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
        autoDigButton.Text = "Auto Dig: OFF"
    end
end

local function updateSpeedUI()
    if speedHackEnabled then
        speedToggleBtn.BackgroundColor3 = Color3.fromRGB(0, 200, 80)
        speedToggleBtn.Text = "Speed: ON"
    else
        speedToggleBtn.BackgroundColor3 = Color3.fromRGB(220, 40, 40)
        speedToggleBtn.Text = "Speed: OFF"
    end
end

--==================================================================================--
--            AUTO ACID SYSTEM FUNCTIONS                                            --
--==================================================================================--

local function cleanupConnections()
    if abilityChangedConnection then abilityChangedConnection:Disconnect(); abilityChangedConnection = nil end
    if childAddedConnection then childAddedConnection:Disconnect(); childAddedConnection = nil end
    if childRemovedConnection then childRemovedConnection:Disconnect(); childRemovedConnection = nil end
end

local function findNearestEnemyPlayer()
    local nearestEnemy, minDistance = nil, math.huge
    for _, player in ipairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character and player.Character.PrimaryPart and player.Character:FindFirstChildOfClass("Humanoid") and player.Character.Humanoid.Health > 0 then
            if not player.Team or (player.Team ~= LocalPlayer.Team) then
                local distance = (rootPart.Position - player.Character.PrimaryPart.Position).Magnitude
                if distance < minDistance then minDistance = distance; nearestEnemy = player end
            end
        end
    end
    return nearestEnemy, minDistance
end

local function onAbilityReadyChanged(newValue) end

local function onChildAdded(child) 
    if child.Name == "AbilityReady" then setupAbilityMonitor(character) end 
end

local function onChildRemoved(child) 
    if child.Name == "AbilityReady" then setupAbilityMonitor(character) end 
end

function setupAbilityMonitor(char)
    cleanupConnections()
    if not isSystemActive or not char then return end
    local abilityReadyValue = char:FindFirstChild("AbilityReady")
    if abilityReadyValue then
        abilityChangedConnection = abilityReadyValue.Changed:Connect(onAbilityReadyChanged)
        childRemovedConnection = char.ChildRemoved:Connect(onChildRemoved)
        onAbilityReadyChanged(abilityReadyValue.Value)
    else
        childAddedConnection = char.ChildAdded:Connect(onChildAdded)
    end
end

--==================================================================================--
--            MAIN RENDER LOOP FOR AUTO ACID                                        --
--==================================================================================--

local function onRenderStep()
    if not isSystemActive or not humanoid or humanoid.Health <= 0 then return end

    local targetPlayer, distance = findNearestEnemyPlayer()

    if targetPlayer and distance <= ACTIVATION_DISTANCE then
        local char = LocalPlayer.Character
        if not char then return end

        local abilityReadyValue = char:FindFirstChild("AbilityReady")

        if abilityReadyValue and (abilityReadyValue.Value == true or string.lower(tostring(abilityReadyValue.Value)) == "enabled") then
            local targetPosition = targetPlayer.Character and targetPlayer.Character.PrimaryPart and targetPlayer.Character.PrimaryPart.Position

            if targetPosition then
                if legitMode then
                    pcall(function()
                        VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.F, false, game)
                        VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.F, false, game)
                    end)
                end

                local args = {
                    [1] = targetPosition
                }

                pcall(function()
                    for i = 1, 1 do
                        ReplicatedStorage.ServerEvents.Acid:InvokeServer(unpack(args))
                    end
                end)
            end
        end
    end
end

--==================================================================================--
--            TOGGLING LOGIC                                                        --
--==================================================================================--

local function setSystemState(shouldBeActive)
    isSystemActive = shouldBeActive
    updateStatusUI()
    if isSystemActive then
        setupAbilityMonitor(character)
    else
        cleanupConnections()
    end
end

function handleToggleAction(actionName, inputState, inputObject)
    if actionName == ACTION_TOGGLE_SYSTEM and inputState == Enum.UserInputState.Begin then
        setSystemState(not isSystemActive)
    end
    return Enum.ContextActionResult.Sink
end

function handleAutoWalkToggle(actionName, inputState, inputObject)
    if actionName == ACTION_TOGGLE_AUTOWALK and inputState == Enum.UserInputState.Begin then
        toggleAutoWalk()
    end
    return Enum.ContextActionResult.Sink
end

--==================================================================================--
--            BUTTON TOGGLE LOGIC                                                   --
--==================================================================================--

statusButton.Activated:Connect(function()
    setSystemState(not isSystemActive)
end)

legitModeButton.Activated:Connect(function()
    legitMode = not legitMode
    updateLegitModeUI()
end)

-- Kill Aura Toggle Logic
killAuraButton.Activated:Connect(function()
    if autoDigEnabled then return end
    killAuraEnabled = not killAuraEnabled
    updateKillAuraUI()
end)

-- Auto Dig Toggle Logic
autoDigButton.Activated:Connect(function()
    autoDigEnabled = not autoDigEnabled
    
    if autoDigEnabled then
        killAuraStateBeforeAutoDig = killAuraEnabled
        updateKillAuraUI()
    else
        if killAuraStateBeforeAutoDig ~= nil then
            killAuraEnabled = killAuraStateBeforeAutoDig
        end
        updateKillAuraUI()
    end
    
    updateAutoDigUI()
end)

noclipButton.Activated:Connect(function()
    noclipEnabled = not noclipEnabled
    if noclipEnabled then
        noclip()
    else
        clip()
    end
    updateNoclipUI()
end)

espButton.Activated:Connect(function()
    espEnabled = not espEnabled
    updateESPUI()
end)

espTeamcheckButton.Activated:Connect(function()
    espTeamCheck = not espTeamCheck
    updateESPTeamcheckUI()
end)

-- Speed Logic
speedToggleBtn.Activated:Connect(function()
    speedHackEnabled = not speedHackEnabled
    updateSpeedUI()
end)

-- Slider Logic
local isDraggingSlider = false

local function updateSliderValue(input)
    local sliderX = speedSliderBar.AbsolutePosition.X
    local sliderWidth = speedSliderBar.AbsoluteSize.X
    local inputX = input.Position.X

    local percent = math.clamp((inputX - sliderX) / sliderWidth, 0, 1)
    speedSliderBtn.Position = UDim2.new(percent, 0, 0.5, 0)

    speedValue = math.floor(minSpeed + ((maxSpeed - minSpeed) * percent))
    speedLabel.Text = "Speed: " .. speedValue
end

speedSliderBar.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        isDraggingSlider = true
        updateSliderValue(input)
    end
end)

speedSliderBtn.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        isDraggingSlider = true
    end
end)

UserInputService.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        isDraggingSlider = false
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if isDraggingSlider and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
        updateSliderValue(input)
    end
end)

local function initSlider()
    local percent = (speedValue - minSpeed) / (maxSpeed - minSpeed)
    speedSliderBtn.Position = UDim2.new(percent, 0, 0.5, 0)
end
initSlider()

--==================================================================================--
--            AUTO WALK LOGIC                                                       --
--==================================================================================--

function toggleAutoWalk()
    isAutoWalkEnabled = not isAutoWalkEnabled

    if isAutoWalkEnabled then
        if not manualWKeyUpConnection then
            manualWKeyUpConnection = UserInputService.InputEnded:Connect(function(input)
                if isAutoWalkEnabled and input.KeyCode == Enum.KeyCode.W then
                    toggleAutoWalk()
                end
            end)
        end
        pcall(function() VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.W, false, game) end)
    else
        pcall(function() VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.W, false, game) end)
        if manualWKeyUpConnection then
            manualWKeyUpConnection:Disconnect()
            manualWKeyUpConnection = nil
        end
    end

    updateAutoWalkUI()
end

--==================================================================================--
--            INITIAL SETUP                                                         --
--==================================================================================--

updateStatusUI()
updateAutoWalkUI()
updateLegitModeUI()
updateKillAuraUI()
updateNoclipUI()
updateESPUI()
updateESPTeamcheckUI()
updateAutoDigUI()
updateSpeedUI()

local highPriority = Enum.ContextActionPriority.High.Value
ContextActionService:BindActionAtPriority(ACTION_TOGGLE_SYSTEM, handleToggleAction, false, highPriority, Enum.KeyCode.Q)
ContextActionService:BindActionAtPriority(ACTION_TOGGLE_AUTOWALK, handleAutoWalkToggle, false, highPriority, Enum.KeyCode.G)
RunService.RenderStepped:Connect(onRenderStep)

task.wait(0.5)
updateAllESPViz()

--==================================================================================--
--            CHARACTER RESPAWN HANDLING                                            --
--==================================================================================--

local function setupCharacter(newCharacter)
    character = newCharacter
    humanoid = newCharacter:WaitForChild("Humanoid")
    rootPart = newCharacter:WaitForChild("HumanoidRootPart")

    if isSystemActive then
        setupAbilityMonitor(newCharacter)
    end
    if isAutoWalkEnabled then
        pcall(function() VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.W, false, game) end)
    end

    reapplyNoclipIfEnabled()

    task.wait(0.2)
    updateAllESPViz()
end

LocalPlayer.CharacterAdded:Connect(setupCharacter)

if LocalPlayer.Character then
    setupCharacter(LocalPlayer.Character)
end
Ant War 🐜 ANT WAR | KILL AURA HITBOX EXPANDER AUTO DIG AUTO ACID
Key System
Mobile Friendly
2,109 views
10 months ago

ANT WAR | KILL AURA HITBOX EXPANDER AUTO DIG AUTO ACID

WORKING
Free

Description

Join Discord for the script

Related Scripts