Auto Mine and Click
Key Required

Auto Mine and Click

Infinite Drill Simulator 🔥S*ch_AlohaS*ch_Aloha 1.8K views 60 executesUpdated Mar 17, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•1325 lines (49701 chars)
-- ============================================
-- AUTO MINE GUI SCRIPT v2.8 — Infinite Drill Simulator
-- ============================================

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

player.CharacterAdded:Connect(function(char)
    character = char
end)

-- ============================================
-- СОХРАНЕНИЕ НАСТРОЕК
-- ============================================

local SAVE_FILE = "InfiniteDrillSimulator_Settings.json"

local function saveSettings()
    local data = {
        toggleKey = State and State.toggleKey and State.toggleKey.Name or "RightControl",
        mineDelay = State and State.mineDelay or 0,
        clickDelay = State and State.clickDelay or 0.05,
        autoClaimEnabled = State and State.autoClaimEnabled or true,
        teleportToClick = State and State.teleportToClick or true,
        useVipPump = State and State.useVipPump or false,
        selectedZone = State and State.selectedZone or nil,
        selectedMine = State and State.selectedMine or nil,
    }
    pcall(function()
        writefile(SAVE_FILE, game:GetService("HttpService"):JSONEncode(data))
    end)
end

local function loadSettings()
    local ok, content = pcall(function()
        return readfile(SAVE_FILE)
    end)
    if ok and content and content ~= "" then
        local ok2, data = pcall(function()
            return game:GetService("HttpService"):JSONDecode(content)
        end)
        if ok2 and data then return data end
    end
    return {}
end

local savedSettings = loadSettings()

local State = {
    selectedZone = savedSettings.selectedZone or nil,
    selectedMine = savedSettings.selectedMine or nil,
    drillObject = nil,
    replicaId = nil,
    autoDetectEnabled = false,
    autoMineEnabled = false,
    autoClickEnabled = false,
    autoClaimEnabled = savedSettings.autoClaimEnabled ~= nil and savedSettings.autoClaimEnabled or true,
    teleportToClick = savedSettings.teleportToClick ~= nil and savedSettings.teleportToClick or true,
    useVipPump = savedSettings.useVipPump or false,
    detectConnection = nil,
    mineDelay = savedSettings.mineDelay or 0,
    clickDelay = savedSettings.clickDelay or 0.05,
    currentClickRid = nil,
    currentClickObjRef = nil,
    currentTeleportTarget = nil,
    toggleKey = Enum.KeyCode[savedSettings.toggleKey or "RightControl"] or Enum.KeyCode.RightControl,
}

local remoteSignal = ReplicatedStorage:WaitForChild("ReplicaRemoteEvents"):WaitForChild("Replica_ReplicaSignal")

-- ============================================
-- УТИЛИТЫ
-- ============================================

local function getReplicaIdFromObject(obj)
    if not obj then return nil end
    local rid = obj:GetAttribute("_ReplicaId")
    if rid then return rid end
    for _, child in pairs(obj:GetChildren()) do
        if (child:IsA("IntValue") or child:IsA("NumberValue")) then
            if child.Name == "_ReplicaId" or child.Name == "ReplicaId" then
                return child.Value
            end
        end
    end
    local nameNum = tonumber(obj.Name)
    if nameNum then return nameNum end
    return nil
end

local function teleportTo(position)
    local char = player.Character
    if not char then return end
    local hrp = char:FindFirstChild("HumanoidRootPart")
    if not hrp then return end
    hrp.CFrame = CFrame.new(position + Vector3.new(0, 3, 0))
end

local function getObjectPosition(obj)
    if not obj then return nil end
    if obj:IsA("BasePart") then return obj.Position end
    for _, desc in pairs(obj:GetDescendants()) do
        if desc:IsA("BasePart") then return desc.Position end
    end
    return nil
end

local function getPlayerPosition()
    local char = player.Character
    if not char then return nil end
    local hrp = char:FindFirstChild("HumanoidRootPart")
    if not hrp then return nil end
    return hrp.Position
end

local function getDistanceTo(position)
    local playerPos = getPlayerPosition()
    if not playerPos or not position then return math.huge end
    return (playerPos - position).Magnitude
end

local function getDistanceToObject(obj)
    return getDistanceTo(getObjectPosition(obj))
end

-- ============================================
-- ДРЕЛЬ (ИСПРАВЛЕНО v2)
-- ============================================

local function findPlayerDrill()
    local char = player.Character
    if not char then return nil end
    local humanoid = char:FindFirstChildOfClass("Humanoid")
    local hrp = char:FindFirstChild("HumanoidRootPart")

    -- Собираем все дрели в workspace
    local allDrills = {}
    for _, obj in pairs(workspace:GetChildren()) do
        if obj:IsA("Model") or obj:IsA("Folder") then
            local hasSeatPart = obj:FindFirstChild("SeatPart")
            local hasDrillBody = obj:FindFirstChild("DrillBody")
            local hasAnimations = obj:FindFirstChild("Animations")
            local hasBlocksFolder = obj:FindFirstChild("BlocksFolder")
            if hasDrillBody or (hasSeatPart and hasAnimations) or (hasSeatPart and hasBlocksFolder) then
                table.insert(allDrills, obj)
            end
        end
    end

    if #allDrills == 0 then return nil end

    -- СПОСОБ 1: Humanoid.SeatPart — на чём сидит игрок
    if humanoid and humanoid.Sit then
        local seatPart = humanoid.SeatPart
        if seatPart then
            for _, drill in ipairs(allDrills) do
                if seatPart:IsDescendantOf(drill) then
                    return drill
                end
                local drillSeat = drill:FindFirstChild("SeatPart")
                if drillSeat then
                    if drillSeat == seatPart then
                        return drill
                    end
                    if drillSeat:IsA("Model") or drillSeat:IsA("Folder") then
                        if seatPart:IsDescendantOf(drillSeat) then
                            return drill
                        end
                    end
                end
            end
        end
    end

    -- СПОСОБ 2: Проверяем Occupant у всех Seat внутри дрели
    if humanoid then
        for _, drill in ipairs(allDrills) do
            local seatFolder = drill:FindFirstChild("SeatPart")
            if seatFolder then
                -- SeatPart сам может быть Seat
                if (seatFolder:IsA("Seat") or seatFolder:IsA("VehicleSeat")) then
                    if seatFolder.Occupant == humanoid then
                        return drill
                    end
                end
                -- Или внутри SeatPart есть Seat
                for _, desc in pairs(seatFolder:GetDescendants()) do
                    if (desc:IsA("Seat") or desc:IsA("VehicleSeat")) then
                        if desc.Occupant == humanoid then
                            return drill
                        end
                    end
                end
            end
            -- Ищем Seat где угодно внутри дрели
            for _, desc in pairs(drill:GetDescendants()) do
                if (desc:IsA("Seat") or desc:IsA("VehicleSeat")) then
                    if desc.Occupant == humanoid then
                        return drill
                    end
                end
            end
        end
    end

    -- СПОСОБ 3: Weld — персонаж приварен к дрели через WeldConstraint/Weld
    if hrp then
        for _, drill in ipairs(allDrills) do
            for _, desc in pairs(drill:GetDescendants()) do
                if desc:IsA("WeldConstraint") or desc:IsA("Weld") then
                    if desc.Part0 == hrp or desc.Part1 == hrp then
                        return drill
                    end
                    -- Проверяем любую часть персонажа
                    for _, charPart in pairs(char:GetChildren()) do
                        if charPart:IsA("BasePart") then
                            if desc.Part0 == charPart or desc.Part1 == charPart then
                                return drill
                            end
                        end
                    end
                end
            end
        end
    end

    -- СПОСОБ 4: Персонаж внутри дрели
    if char.Parent then
        for _, drill in ipairs(allDrills) do
            if char:IsDescendantOf(drill) then
                return drill
            end
        end
    end

    -- СПОСОБ 5: Ближайшая дрель по расстоянию
    if hrp then
        local closestDrill = nil
        local closestDist = math.huge
        for _, drill in ipairs(allDrills) do
            for _, desc in pairs(drill:GetDescendants()) do
                if desc:IsA("BasePart") then
                    local dist = (hrp.Position - desc.Position).Magnitude
                    if dist < closestDist then
                        closestDist = dist
                        closestDrill = drill
                    end
                    break
                end
            end
        end
        if closestDrill and closestDist < 50 then
            return closestDrill
        end
    end

    if #allDrills == 1 then
        return allDrills[1]
    end

    return nil
end

-- ============================================
-- ЗОНЫ / ШАХТЫ / БЛОКИ
-- ============================================

local function getZones()
    local zones = {}
    local zonesFolder = workspace:FindFirstChild("Zones")
    if zonesFolder then
        for _, zone in pairs(zonesFolder:GetChildren()) do
            if zone:IsA("Folder") or zone:IsA("Model") then
                table.insert(zones, zone.Name)
            end
        end
    end
    table.sort(zones, function(a, b)
        local na, nb = tonumber(a), tonumber(b)
        if na and nb then return na < nb end
        return a < b
    end)
    return zones
end

local function getMines(zoneName)
    local mines = {}
    local zonesFolder = workspace:FindFirstChild("Zones")
    if not zonesFolder then return mines end
    local zone = zonesFolder:FindFirstChild(tostring(zoneName))
    if not zone then return mines end
    local minesFolder = zone:FindFirstChild("Mines")
    if not minesFolder then return mines end
    for _, mine in pairs(minesFolder:GetChildren()) do
        table.insert(mines, mine.Name)
    end
    table.sort(mines, function(a, b)
        local na, nb = tonumber(a), tonumber(b)
        if na and nb then return na < nb end
        return a < b
    end)
    return mines
end

local function getBlocks(zoneName, mineName)
    local blocks = {}
    local zonesFolder = workspace:FindFirstChild("Zones")
    if not zonesFolder then return blocks end
    local zone = zonesFolder:FindFirstChild(tostring(zoneName))
    if not zone then return blocks end
    local minesFolder = zone:FindFirstChild("Mines")
    if not minesFolder then return blocks end
    local mine = minesFolder:FindFirstChild(tostring(mineName))
    if not mine then return blocks end
    local blockModels = mine:FindFirstChild("BlockModels")
    if not blockModels then return blocks end
    for _, block in pairs(blockModels:GetChildren()) do
        table.insert(blocks, block.Name)
    end
    return blocks
end

local function getMineObject(zoneName, mineName)
    local zonesFolder = workspace:FindFirstChild("Zones")
    if not zonesFolder then return nil end
    local zone = zonesFolder:FindFirstChild(tostring(zoneName))
    if not zone then return nil end
    local minesFolder = zone:FindFirstChild("Mines")
    if not minesFolder then return nil end
    return minesFolder:FindFirstChild(tostring(mineName))
end

local function getWinKeyReplicaId(zoneName, mineName)
    local mine = getMineObject(zoneName, mineName)
    if not mine then return nil end
    local winKey = mine:FindFirstChild("WinKeyModel")
    if not winKey then return nil end
    return getReplicaIdFromObject(winKey)
end

-- ============================================
-- ПОИСК БЛИЖАЙШЕГО CLICK ОБЪЕКТА
-- ============================================

local function findNearestClickObject(useVip)
    local playerPos = getPlayerPosition()
    if not playerPos then return nil, nil, nil, nil end

    local zonesFolder = workspace:FindFirstChild("Zones")
    if not zonesFolder then return nil, nil, nil, nil end

    local closestClickObj = nil
    local closestTeleportTarget = nil
    local closestRid = nil
    local closestDist = math.huge
    local closestName = nil

    for _, zone in pairs(zonesFolder:GetChildren()) do
        if zone:IsA("Folder") or zone:IsA("Model") then
            local utility = zone:FindFirstChild("Utility")
            if utility then
                for _, child in pairs(utility:GetChildren()) do
                    if child:IsA("Folder") or child:IsA("Model") then
                        local powerClickArea = child:FindFirstChild("PowerClickArea")
                        if powerClickArea then
                            local clickArea = powerClickArea:FindFirstChild("ClickArea")
                            local targetForDist = clickArea or powerClickArea
                            local objPos = getObjectPosition(targetForDist)
                            if objPos then
                                local dist = (playerPos - objPos).Magnitude
                                if dist < closestDist then
                                    local rid = getReplicaIdFromObject(powerClickArea)
                                    if not rid and clickArea then rid = getReplicaIdFromObject(clickArea) end
                                    if rid then
                                        closestClickObj = powerClickArea
                                        closestTeleportTarget = clickArea or powerClickArea
                                        closestRid = rid
                                        closestDist = dist
                                        closestName = zone.Name .. "/PowerClickArea"
                                    end
                                end
                            end
                        end
                        if useVip then
                            local vipPower = child:FindFirstChild("VIPPower")
                            if vipPower then
                                local objPos = getObjectPosition(vipPower)
                                if objPos then
                                    local dist = (playerPos - objPos).Magnitude
                                    if dist < closestDist then
                                        local rid = getReplicaIdFromObject(vipPower)
                                        if rid then
                                            closestClickObj = vipPower
                                            closestTeleportTarget = vipPower
                                            closestRid = rid
                                            closestDist = dist
                                            closestName = zone.Name .. "/VIPPower"
                                        end
                                    end
                                end
                            end
                        end
                    end
                end
                for _, desc in pairs(utility:GetDescendants()) do
                    if desc.Name == "ClickArea" and desc:IsA("BasePart") then
                        local parent = desc.Parent
                        local objPos = desc.Position
                        local dist = (playerPos - objPos).Magnitude
                        if dist < closestDist then
                            local rid = getReplicaIdFromObject(parent) or getReplicaIdFromObject(desc)
                            if rid then
                                closestClickObj = parent
                                closestTeleportTarget = desc
                                closestRid = rid
                                closestDist = dist
                                closestName = zone.Name .. "/" .. (parent and parent.Name or "ClickArea")
                            end
                        end
                    end
                end
            end
        end
    end

    return closestClickObj, closestTeleportTarget, closestRid, closestName, closestDist
end

-- ============================================
-- ОПРЕДЕЛЕНИЕ ЗОНЫ
-- ============================================

local function detectPlayerZoneAndMine()
    local playerPos = getPlayerPosition()
    if not playerPos then return nil, nil end

    local zonesFolder = workspace:FindFirstChild("Zones")
    if not zonesFolder then return nil, nil end

    local candidates = {}
    for _, zone in pairs(zonesFolder:GetChildren()) do
        local minesFolder = zone:FindFirstChild("Mines")
        if minesFolder then
            for _, mine in pairs(minesFolder:GetChildren()) do
                local blockModels = mine:FindFirstChild("BlockModels")
                if blockModels then
                    local minDist = math.huge
                    for _, p in pairs(blockModels:GetDescendants()) do
                        if p:IsA("BasePart") then
                            local dist = (playerPos - p.Position).Magnitude
                            if dist < minDist then minDist = dist end
                        end
                    end
                    if minDist < math.huge then
                        table.insert(candidates, { zone = zone.Name, mine = mine.Name, dist = minDist })
                    end
                end
            end
        end
    end

    table.sort(candidates, function(a, b) return a.dist < b.dist end)
    if #candidates > 0 then return candidates[1].zone, candidates[1].mine end
    return nil, nil
end

-- ============================================
-- СОБЫТИЯ
-- ============================================

local function fireMineDamage(blockName)
    if not State.selectedZone or not State.selectedMine or not State.replicaId then return false end
    local mine = getMineObject(State.selectedZone, State.selectedMine)
    if not mine then return false end
    pcall(function()
        remoteSignal:FireServer(State.replicaId, "DamageMine", mine, tostring(blockName))
    end)
    return true
end

local function fireWinClaimed(zoneName, mineName)
    local winRid = getWinKeyReplicaId(zoneName, mineName)
    if not winRid then return false, nil end
    pcall(function()
        remoteSignal:FireServer(winRid, "FireClaimed")
    end)
    return true, winRid
end

local function fireClick(replicaId)
    if not replicaId then return false end
    pcall(function()
        remoteSignal:FireServer(replicaId, "Click")
    end)
    return true
end

-- ============================================
-- GUI СОЗДАНИЕ
-- ============================================

if player.PlayerGui:FindFirstChild("AutoMineGUI") then
    player.PlayerGui:FindFirstChild("AutoMineGUI"):Destroy()
end

local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AutoMineGUI"
screenGui.ResetOnSpawn = false
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
screenGui.Parent = player.PlayerGui

-- МИНИ КНОПКА
local miniButton = Instance.new("TextButton")
miniButton.Name = "MiniButton"
miniButton.Size = UDim2.new(0, 48, 0, 48)
miniButton.Position = UDim2.new(0, 10, 0.5, -24)
miniButton.BackgroundColor3 = Color3.fromRGB(30, 30, 45)
miniButton.Text = "⛏️"
miniButton.TextSize = 24
miniButton.Font = Enum.Font.GothamBold
miniButton.TextColor3 = Color3.fromRGB(80, 180, 255)
miniButton.BorderSizePixel = 0
miniButton.Active = true
miniButton.Draggable = true
miniButton.Visible = false
miniButton.Parent = screenGui
Instance.new("UICorner", miniButton).CornerRadius = UDim.new(0, 10)
Instance.new("UIStroke", miniButton).Color = Color3.fromRGB(80, 120, 255)

-- ГЛАВНЫЙ ФРЕЙМ
local mainFrame = Instance.new("Frame")
mainFrame.Name = "MainFrame"
mainFrame.Size = UDim2.new(0, 370, 0, 510)
mainFrame.Position = UDim2.new(0.5, -185, 0.5, -255)
mainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 35)
mainFrame.BorderSizePixel = 0
mainFrame.Active = true
mainFrame.Draggable = true
mainFrame.Parent = screenGui
Instance.new("UICorner", mainFrame).CornerRadius = UDim.new(0, 12)
Instance.new("UIStroke", mainFrame).Color = Color3.fromRGB(80, 120, 255)

-- Заголовок
local titleBar = Instance.new("Frame")
titleBar.Size = UDim2.new(1, 0, 0, 36)
titleBar.BackgroundColor3 = Color3.fromRGB(35, 35, 50)
titleBar.BorderSizePixel = 0
titleBar.Parent = mainFrame
Instance.new("UICorner", titleBar).CornerRadius = UDim.new(0, 12)

local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(1, -70, 1, 0)
titleLabel.Position = UDim2.new(0, 10, 0, 0)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "⛏️ Infinite Drill Simulator"
titleLabel.TextColor3 = Color3.fromRGB(80, 180, 255)
titleLabel.TextSize = 13
titleLabel.Font = Enum.Font.GothamBold
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.TextScaled = false
titleLabel.Parent = titleBar

local minimizeBtn = Instance.new("TextButton")
minimizeBtn.Size = UDim2.new(0, 26, 0, 26)
minimizeBtn.Position = UDim2.new(1, -58, 0, 5)
minimizeBtn.BackgroundColor3 = Color3.fromRGB(80, 120, 200)
minimizeBtn.Text = "—"
minimizeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
minimizeBtn.TextSize = 13
minimizeBtn.Font = Enum.Font.GothamBold
minimizeBtn.BorderSizePixel = 0
minimizeBtn.Parent = titleBar
Instance.new("UICorner", minimizeBtn).CornerRadius = UDim.new(0, 5)

local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0, 26, 0, 26)
closeBtn.Position = UDim2.new(1, -29, 0, 5)
closeBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
closeBtn.Text = "X"
closeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
closeBtn.TextSize = 12
closeBtn.Font = Enum.Font.GothamBold
closeBtn.BorderSizePixel = 0
closeBtn.Parent = titleBar
Instance.new("UICorner", closeBtn).CornerRadius = UDim.new(0, 5)

-- Контент
local contentFrame = Instance.new("ScrollingFrame")
contentFrame.Size = UDim2.new(1, -12, 1, -42)
contentFrame.Position = UDim2.new(0, 6, 0, 39)
contentFrame.BackgroundTransparency = 1
contentFrame.ScrollBarThickness = 3
contentFrame.ScrollBarImageColor3 = Color3.fromRGB(80, 120, 255)
contentFrame.CanvasSize = UDim2.new(0, 0, 0, 900)
contentFrame.Parent = mainFrame

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

-- ============================================
-- GUI ХЕЛПЕРЫ
-- ============================================

local function createSection(name, parent, order)
    local s = Instance.new("Frame")
    s.Size = UDim2.new(1, 0, 0, 20)
    s.BackgroundColor3 = Color3.fromRGB(40, 40, 55)
    s.BorderSizePixel = 0
    s.LayoutOrder = order
    s.Parent = parent
    Instance.new("UICorner", s).CornerRadius = UDim.new(0, 4)
    local l = Instance.new("TextLabel")
    l.Size = UDim2.new(1, -8, 1, 0)
    l.Position = UDim2.new(0, 8, 0, 0)
    l.BackgroundTransparency = 1
    l.Text = name
    l.TextColor3 = Color3.fromRGB(200, 200, 220)
    l.TextSize = 11
    l.Font = Enum.Font.GothamBold
    l.TextXAlignment = Enum.TextXAlignment.Left
    l.TextScaled = false
    l.Parent = s
    return s
end

local function createButton(text, parent, order, color)
    color = color or Color3.fromRGB(60, 60, 80)
    local btn = Instance.new("TextButton")
    btn.Size = UDim2.new(1, 0, 0, 24)
    btn.BackgroundColor3 = color
    btn.Text = text
    btn.TextColor3 = Color3.fromRGB(220, 220, 240)
    btn.TextSize = 11
    btn.Font = Enum.Font.GothamSemibold
    btn.BorderSizePixel = 0
    btn.LayoutOrder = order
    btn.TextScaled = false
    btn.Parent = parent
    Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 4)
    return btn
end

local function createInfoRow(parent, order)
    local row = Instance.new("Frame")
    row.Size = UDim2.new(1, 0, 0, 16)
    row.BackgroundTransparency = 1
    row.LayoutOrder = order
    row.Parent = parent
    return row
end

local function createInfoLabelInRow(text, row, xScale, width)
    local l = Instance.new("TextLabel")
    l.Size = UDim2.new(0, width, 1, 0)
    l.Position = UDim2.new(xScale, 0, 0, 0)
    l.BackgroundTransparency = 1
    l.Text = text
    l.TextColor3 = Color3.fromRGB(150, 150, 170)
    l.TextSize = 11
    l.Font = Enum.Font.Gotham
    l.TextXAlignment = Enum.TextXAlignment.Left
    l.TextScaled = false
    l.ClipsDescendants = false
    l.Parent = row
    return l
end

local function createButtonRow(parent, order)
    local row = Instance.new("Frame")
    row.Size = UDim2.new(1, 0, 0, 24)
    row.BackgroundTransparency = 1
    row.LayoutOrder = order
    row.Parent = parent
    return row
end

local function createHalfButton(text, parent, color, isLeft)
    color = color or Color3.fromRGB(60, 60, 80)
    local btn = Instance.new("TextButton")
    btn.Size = UDim2.new(0.49, 0, 1, 0)
    btn.Position = isLeft and UDim2.new(0, 0, 0, 0) or UDim2.new(0.51, 0, 0, 0)
    btn.BackgroundColor3 = color
    btn.Text = text
    btn.TextColor3 = Color3.fromRGB(220, 220, 240)
    btn.TextSize = 11
    btn.Font = Enum.Font.GothamSemibold
    btn.BorderSizePixel = 0
    btn.TextScaled = false
    btn.Parent = parent
    Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 4)
    return btn
end

local function createCheckbox(text, parent, order, defaultValue, callback)
    local row = Instance.new("Frame")
    row.Size = UDim2.new(1, 0, 0, 20)
    row.BackgroundTransparency = 1
    row.LayoutOrder = order
    row.Parent = parent

    local box = Instance.new("TextButton")
    box.Size = UDim2.new(0, 18, 0, 18)
    box.Position = UDim2.new(0, 0, 0, 1)
    box.BackgroundColor3 = defaultValue and Color3.fromRGB(30, 120, 30) or Color3.fromRGB(60, 60, 80)
    box.Text = defaultValue and "✓" or ""
    box.TextColor3 = Color3.fromRGB(255, 255, 255)
    box.TextSize = 12
    box.Font = Enum.Font.GothamBold
    box.BorderSizePixel = 0
    box.Parent = row
    Instance.new("UICorner", box).CornerRadius = UDim.new(0, 3)

    local label = Instance.new("TextLabel")
    label.Size = UDim2.new(1, -24, 1, 0)
    label.Position = UDim2.new(0, 22, 0, 0)
    label.BackgroundTransparency = 1
    label.Text = text
    label.TextColor3 = Color3.fromRGB(180, 180, 200)
    label.TextSize = 11
    label.Font = Enum.Font.Gotham
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.TextScaled = false
    label.Parent = row

    local checked = defaultValue

    box.MouseButton1Click:Connect(function()
        checked = not checked
        box.Text = checked and "✓" or ""
        box.BackgroundColor3 = checked and Color3.fromRGB(30, 120, 30) or Color3.fromRGB(60, 60, 80)
        if callback then callback(checked) end
        saveSettings()
    end)

    return { getValue = function() return checked end }
end

local mineDropdown

local function createDropdown(name, options, parent, order, callback)
    local df = Instance.new("Frame")
    df.Size = UDim2.new(1, 0, 0, 24)
    df.BackgroundColor3 = Color3.fromRGB(45, 45, 60)
    df.BorderSizePixel = 0
    df.LayoutOrder = order
    df.ClipsDescendants = true
    df.Parent = parent
    Instance.new("UICorner", df).CornerRadius = UDim.new(0, 4)

    local db = Instance.new("TextButton")
    db.Size = UDim2.new(1, 0, 0, 24)
    db.BackgroundTransparency = 1
    db.Text = " " .. name .. ": - ▼"
    db.TextColor3 = Color3.fromRGB(180, 180, 200)
    db.TextSize = 11
    db.Font = Enum.Font.GothamSemibold
    db.TextXAlignment = Enum.TextXAlignment.Left
    db.Parent = df

    local isOpen = false
    local optBtns = {}

    local function refreshOptions(newOpts)
        for _, b in pairs(optBtns) do b:Destroy() end
        optBtns = {}
        for i, opt in ipairs(newOpts) do
            local ob = Instance.new("TextButton")
            ob.Size = UDim2.new(1, -4, 0, 20)
            ob.Position = UDim2.new(0, 2, 0, 24 + (i - 1) * 22)
            ob.BackgroundColor3 = Color3.fromRGB(55, 55, 75)
            ob.Text = tostring(opt)
            ob.TextColor3 = Color3.fromRGB(200, 200, 220)
            ob.TextSize = 11
            ob.Font = Enum.Font.Gotham
            ob.BorderSizePixel = 0
            ob.Parent = df
            Instance.new("UICorner", ob).CornerRadius = UDim.new(0, 3)
            ob.MouseButton1Click:Connect(function()
                db.Text = " " .. name .. ": " .. tostring(opt) .. " ▼"
                isOpen = false
                df.Size = UDim2.new(1, 0, 0, 24)
                if callback then callback(opt) end
            end)
            table.insert(optBtns, ob)
        end
    end

    refreshOptions(options)

    db.MouseButton1Click:Connect(function()
        isOpen = not isOpen
        df.Size = isOpen and UDim2.new(1, 0, 0, 24 + #optBtns * 22 + 2) or UDim2.new(1, 0, 0, 24)
    end)

    return {
        frame = df, button = db,
        refresh = refreshOptions,
        setSelected = function(val) db.Text = " " .. name .. ": " .. tostring(val) .. " ▼" end
    }
end

-- ============================================
-- GUI ЭЛЕМЕНТЫ
-- ============================================

-- LOCATION
createSection("🗺️ LOCATION", contentFrame, 1)

local locationRow = createInfoRow(contentFrame, 2)
local zoneInfoLabel = createInfoLabelInRow("Zone: -", locationRow, 0, 160)
local mineInfoLabel = createInfoLabelInRow("Mine: -", locationRow, 0.5, 160)

local zoneDropdown = createDropdown("Zone", getZones(), contentFrame, 3, function(val)
    State.selectedZone = val
    zoneInfoLabel.Text = "Zone: " .. tostring(val)
    mineDropdown.refresh(getMines(val))
    State.selectedMine = nil
    mineInfoLabel.Text = "Mine: -"
    saveSettings()
end)

mineDropdown = createDropdown("Mine", {}, contentFrame, 4, function(val)
    State.selectedMine = val
    mineInfoLabel.Text = "Mine: " .. tostring(val)
    saveSettings()
end)

-- Ряд кнопок авто-детекта: [Auto Detect: ON/OFF] [Detect Once]
local detectBtnRow = createButtonRow(contentFrame, 5)
local autoDetectBtn = createHalfButton("📍 Auto Detect: OFF", detectBtnRow, Color3.fromRGB(80, 50, 50), true)
local detectOnceBtn = createHalfButton("🎯 Detect Once", detectBtnRow, Color3.fromRGB(50, 70, 110), false)

-- MINING
createSection("⛏️ MINING", contentFrame, 10)

local drillRow = createInfoRow(contentFrame, 11)
local drillInfoLabel = createInfoLabelInRow("Drill: ...", drillRow, 0, 180)
local replicaInfoLabel = createInfoLabelInRow("RID: -", drillRow, 0.55, 140)

local statusRow = createInfoRow(contentFrame, 12)
local statusLabel = createInfoLabelInRow("Status: IDLE", statusRow, 0, 180)
local blocksMinedLabel = createInfoLabelInRow("Blocks: 0", statusRow, 0.55, 140)

local delayRow = createInfoRow(contentFrame, 13)
local delayInfoLabel = createInfoLabelInRow("Delay: " .. State.mineDelay .. "s", delayRow, 0, 100)
local claimStatusLabel = createInfoLabelInRow("Claim: -", delayRow, 0.3, 200)

local delayBtnRow = createButtonRow(contentFrame, 14)
local decreaseDelayBtn = createHalfButton("⬇️ -0.05s", delayBtnRow, Color3.fromRGB(60, 60, 80), true)
local increaseDelayBtn = createHalfButton("⬆️ +0.05s", delayBtnRow, Color3.fromRGB(60, 60, 80), false)

local autoClaimBtn = createButton(
    State.autoClaimEnabled and "🏆 Auto Claim: ON" or "🏆 Auto Claim: OFF",
    contentFrame, 15,
    State.autoClaimEnabled and Color3.fromRGB(30, 100, 30) or Color3.fromRGB(100, 30, 30)
)

local mineBtnRow = createButtonRow(contentFrame, 16)
local startMineBtn = createHalfButton("▶️ START", mineBtnRow, Color3.fromRGB(30, 120, 30), true)
local stopMineBtn = createHalfButton("⏹️ STOP", mineBtnRow, Color3.fromRGB(120, 30, 30), false)

-- AUTO CLICK
createSection("🖱️ AUTO CLICK", contentFrame, 30)

local clickRow1 = createInfoRow(contentFrame, 31)
local clickInfoLabel = createInfoLabelInRow("Click: -", clickRow1, 0, 340)

local clickRow1b = createInfoRow(contentFrame, 32)
local clickTpLabel = createInfoLabelInRow("TP to: -", clickRow1b, 0, 340)

local clickRow2 = createInfoRow(contentFrame, 33)
local clickRidLabel = createInfoLabelInRow("RID: -", clickRow2, 0, 100)
local clickDistLabel = createInfoLabelInRow("Dist: -", clickRow2, 0.3, 80)
local clickStatusLabel = createInfoLabelInRow("Status: OFF", clickRow2, 0.55, 140)

local clickRow3 = createInfoRow(contentFrame, 34)
local clickCountLabel = createInfoLabelInRow("Clicks: 0", clickRow3, 0, 100)
local clickDelayLabel = createInfoLabelInRow("Delay: " .. State.clickDelay .. "s", clickRow3, 0.3, 100)

local detectClickBtn = createButton("🔍 Detect Nearest Click Object", contentFrame, 35, Color3.fromRGB(50, 80, 120))

local vipCheckbox = createCheckbox("🌟 VIP Pump Priority", contentFrame, 36, State.useVipPump, function(val)
    State.useVipPump = val
    saveSettings()
end)

local tpCheckbox = createCheckbox("🔀 Teleport to ClickArea", contentFrame, 37, State.teleportToClick, function(val)
    State.teleportToClick = val
    saveSettings()
end)

local clickDelayRow = createButtonRow(contentFrame, 38)
local clickDelayDecBtn = createHalfButton("⬇️ -0.01s", clickDelayRow, Color3.fromRGB(60, 60, 80), true)
local clickDelayIncBtn = createHalfButton("⬆️ +0.01s", clickDelayRow, Color3.fromRGB(60, 60, 80), false)

local clickBtnRow = createButtonRow(contentFrame, 39)
local startClickBtn = createHalfButton("▶️ START", clickBtnRow, Color3.fromRGB(30, 100, 120), true)
local stopClickBtn = createHalfButton("⏹️ STOP", clickBtnRow, Color3.fromRGB(120, 60, 30), false)

-- KEYBIND
createSection("⌨️ KEYBIND", contentFrame, 50)

local keybindLabel = Instance.new("TextLabel")
keybindLabel.Size = UDim2.new(1, 0, 0, 16)
keybindLabel.BackgroundTransparency = 1
keybindLabel.Text = "Toggle: " .. State.toggleKey.Name
keybindLabel.TextColor3 = Color3.fromRGB(150, 150, 170)
keybindLabel.TextSize = 11
keybindLabel.Font = Enum.Font.Gotham
keybindLabel.TextXAlignment = Enum.TextXAlignment.Left
keybindLabel.TextScaled = false
keybindLabel.LayoutOrder = 51
keybindLabel.Parent = contentFrame

local changeKeyBtn = createButton("🔑 Change Key", contentFrame, 52, Color3.fromRGB(80, 60, 120))
local waitingForKey = false

-- Canvas авто-обновление
local function updateCanvasSize()
    contentFrame.CanvasSize = UDim2.new(0, 0, 0, contentLayout.AbsoluteContentSize.Y + 10)
end
contentLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(updateCanvasSize)
task.defer(updateCanvasSize)

-- ============================================
-- ЛОГИКА
-- ============================================

local function updateDrillInfo()
    local drill = findPlayerDrill()
    if drill then
        State.drillObject = drill
        drillInfoLabel.Text = "Drill: " .. drill.Name
        drillInfoLabel.TextColor3 = Color3.fromRGB(100, 200, 255)
        local rid = getReplicaIdFromObject(drill)
        if rid then
            State.replicaId = rid
            replicaInfoLabel.Text = "RID: " .. tostring(rid)
            replicaInfoLabel.TextColor3 = Color3.fromRGB(100, 200, 255)
        else
            replicaInfoLabel.Text = "RID: ?"
            replicaInfoLabel.TextColor3 = Color3.fromRGB(255, 200, 100)
        end
        return true
    else
        State.drillObject = nil
        State.replicaId = nil
        drillInfoLabel.Text = "Drill: Not found"
        drillInfoLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
        replicaInfoLabel.Text = "RID: -"
        replicaInfoLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
        return false
    end
end

-- Восстановить сохранённую зону/шахту при загрузке
task.defer(function()
    if State.selectedZone then
        zoneDropdown.setSelected(State.selectedZone)
        zoneInfoLabel.Text = "Zone: " .. tostring(State.selectedZone)
        mineDropdown.refresh(getMines(State.selectedZone))
        if State.selectedMine then
            mineDropdown.setSelected(State.selectedMine)
            mineInfoLabel.Text = "Mine: " .. tostring(State.selectedMine)
        end
    end
end)

-- АВТО ПРОВЕРКА ДРЕЛИ
task.spawn(function()
    while true do
        updateDrillInfo()
        task.wait(2)
    end
end)

-- DETECT ONCE — одноразовое определение зоны
detectOnceBtn.MouseButton1Click:Connect(function()
    detectOnceBtn.BackgroundColor3 = Color3.fromRGB(80, 80, 30)
    local zone, mine = detectPlayerZoneAndMine()
    if zone and mine then
        State.selectedZone = zone
        State.selectedMine = mine
        zoneInfoLabel.Text = "Zone: " .. tostring(zone)
        zoneInfoLabel.TextColor3 = Color3.fromRGB(100, 200, 255)
        zoneDropdown.setSelected(zone)
        mineDropdown.refresh(getMines(zone))
        mineDropdown.setSelected(mine)
        mineInfoLabel.Text = "Mine: " .. tostring(mine)
        mineInfoLabel.TextColor3 = Color3.fromRGB(100, 200, 255)
        detectOnceBtn.BackgroundColor3 = Color3.fromRGB(30, 100, 30)
        saveSettings()
    else
        detectOnceBtn.BackgroundColor3 = Color3.fromRGB(120, 30, 30)
    end
    task.delay(1.5, function()
        detectOnceBtn.BackgroundColor3 = Color3.fromRGB(50, 70, 110)
    end)
end)

-- DETECT CLICK OBJECT (ручная кнопка)
detectClickBtn.MouseButton1Click:Connect(function()
    local clickObj, tpTarget, rid, name, dist = findNearestClickObject(State.useVipPump)
    if clickObj and rid then
        State.currentClickObjRef = clickObj
        State.currentClickRid = rid
        State.currentTeleportTarget = tpTarget
        clickInfoLabel.Text = "Click: " .. tostring(name or clickObj.Name)
        clickInfoLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
        clickTpLabel.Text = "TP to: " .. (tpTarget and tpTarget.Name or "same")
        clickTpLabel.TextColor3 = Color3.fromRGB(100, 200, 255)
        clickRidLabel.Text = "RID: " .. tostring(rid)
        clickRidLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
        clickDistLabel.Text = "Dist: " .. string.format("%.1f", dist or 0)
        clickDistLabel.TextColor3 = Color3.fromRGB(100, 200, 255)
    else
        clickInfoLabel.Text = "Click: NOT FOUND"
        clickInfoLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
        clickTpLabel.Text = "TP to: -"
        clickRidLabel.Text = "RID: -"
        clickDistLabel.Text = "Dist: -"
    end
end)

-- АВТО ДЕТЕКТ ЗОНЫ
autoDetectBtn.MouseButton1Click:Connect(function()
    State.autoDetectEnabled = not State.autoDetectEnabled
    if State.autoDetectEnabled then
        autoDetectBtn.Text = "📍 Auto Detect: ON"
        autoDetectBtn.BackgroundColor3 = Color3.fromRGB(30, 120, 30)
        State.detectConnection = RunService.Heartbeat:Connect(function()
            local zone, mine = detectPlayerZoneAndMine()
            if zone and (zone ~= State.selectedZone or mine ~= State.selectedMine) then
                State.selectedZone = zone
                State.selectedMine = mine
                zoneInfoLabel.Text = "Zone: " .. tostring(zone)
                zoneInfoLabel.TextColor3 = Color3.fromRGB(100, 200, 255)
                zoneDropdown.setSelected(zone)
                if mine then
                    mineInfoLabel.Text = "Mine: " .. tostring(mine)
                    mineInfoLabel.TextColor3 = Color3.fromRGB(100, 200, 255)
                    mineDropdown.refresh(getMines(zone))
                    mineDropdown.setSelected(mine)
                end
                saveSettings()
            end
        end)
    else
        autoDetectBtn.Text = "📍 Auto Detect: OFF"
        autoDetectBtn.BackgroundColor3 = Color3.fromRGB(80, 50, 50)
        if State.detectConnection then
            State.detectConnection:Disconnect()
            State.detectConnection = nil
        end
    end
end)

-- DELAY (mine)
decreaseDelayBtn.MouseButton1Click:Connect(function()
    State.mineDelay = math.max(0, math.round((State.mineDelay - 0.05) * 100) / 100)
    delayInfoLabel.Text = "Delay: " .. State.mineDelay .. "s"
    saveSettings()
end)
increaseDelayBtn.MouseButton1Click:Connect(function()
    State.mineDelay = math.round((State.mineDelay + 0.05) * 100) / 100
    delayInfoLabel.Text = "Delay: " .. State.mineDelay .. "s"
    saveSettings()
end)

-- AUTO CLAIM
autoClaimBtn.MouseButton1Click:Connect(function()
    State.autoClaimEnabled = not State.autoClaimEnabled
    autoClaimBtn.Text = State.autoClaimEnabled and "🏆 Auto Claim: ON" or "🏆 Auto Claim: OFF"
    autoClaimBtn.BackgroundColor3 = State.autoClaimEnabled and Color3.fromRGB(30, 100, 30) or Color3.fromRGB(100, 30, 30)
    saveSettings()
end)

-- MINING LOOP
local blocksMined = 0

local function tryClaimWithRetry()
    for attempt = 1, 20 do
        if not State.autoMineEnabled then break end
        claimStatusLabel.Text = "Claim: " .. attempt .. "/20"
        claimStatusLabel.TextColor3 = Color3.fromRGB(255, 200, 100)
        fireWinClaimed(State.selectedZone, State.selectedMine)
        task.wait(0.2)
        if #getBlocks(State.selectedZone, State.selectedMine) > 0 then
            claimStatusLabel.Text = "Claim: OK"
            claimStatusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
            return
        end
    end
    claimStatusLabel.Text = "Claim: Wait..."
    while State.autoMineEnabled and #getBlocks(State.selectedZone, State.selectedMine) == 0 do
        task.wait(0.5)
    end
    claimStatusLabel.Text = "Claim: Ready"
    claimStatusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
end

startMineBtn.MouseButton1Click:Connect(function()
    if not updateDrillInfo() then
        statusLabel.Text = "Status: NO DRILL!"
        statusLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
        return
    end
    if not State.selectedZone or not State.selectedMine then
        statusLabel.Text = "Status: SELECT ZONE!"
        statusLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
        return
    end
    State.autoMineEnabled = false
    task.wait(0.1)
    State.autoMineEnabled = true
    blocksMined = 0
    statusLabel.Text = "Status: MINING"
    statusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)

    task.spawn(function()
        while State.autoMineEnabled do
            if not State.replicaId then
                updateDrillInfo()
                if not State.replicaId then
                    statusLabel.Text = "Status: NO DRILL!"
                    task.wait(1)
                    continue
                end
            end
            local blocks = getBlocks(State.selectedZone, State.selectedMine)
            if #blocks > 0 then
                for _, blockName in ipairs(blocks) do
                    if not State.autoMineEnabled then break end
                    if fireMineDamage(blockName) then
                        blocksMined = blocksMined + 1
                        blocksMinedLabel.Text = "Blocks: " .. blocksMined
                    end
                    task.wait(State.mineDelay > 0 and State.mineDelay or 0.01)
                end
                if #getBlocks(State.selectedZone, State.selectedMine) == 0 and State.autoClaimEnabled then
                    statusLabel.Text = "Status: CLAIMING"
                    tryClaimWithRetry()
                    statusLabel.Text = "Status: MINING"
                    statusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
                end
            else
                if State.autoClaimEnabled then
                    tryClaimWithRetry()
                else
                    task.wait(0.5)
                end
            end
        end
    end)
end)

stopMineBtn.MouseButton1Click:Connect(function()
    State.autoMineEnabled = false
    statusLabel.Text = "Status: STOPPED"
    statusLabel.TextColor3 = Color3.fromRGB(255, 200, 100)
end)

-- CLICK DELAY
clickDelayDecBtn.MouseButton1Click:Connect(function()
    State.clickDelay = math.max(0.01, math.round((State.clickDelay - 0.01) * 100) / 100)
    clickDelayLabel.Text = "Delay: " .. State.clickDelay .. "s"
    saveSettings()
end)
clickDelayIncBtn.MouseButton1Click:Connect(function()
    State.clickDelay = math.round((State.clickDelay + 0.01) * 100) / 100
    clickDelayLabel.Text = "Delay: " .. State.clickDelay .. "s"
    saveSettings()
end)

-- AUTO CLICK
startClickBtn.MouseButton1Click:Connect(function()
    State.autoClickEnabled = false
    task.wait(0.1)
    State.autoClickEnabled = true

    if not State.currentClickObjRef or not State.currentClickObjRef.Parent then
        local clickObj, tpTarget, rid, name, dist = findNearestClickObject(State.useVipPump)
        if clickObj and rid then
            State.currentClickObjRef = clickObj
            State.currentClickRid = rid
            State.currentTeleportTarget = tpTarget
            clickInfoLabel.Text = "Click: " .. tostring(name or clickObj.Name)
            clickInfoLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
            clickTpLabel.Text = "TP to: " .. (tpTarget and tpTarget.Name or "same")
            clickRidLabel.Text = "RID: " .. tostring(rid)
            clickDistLabel.Text = "Dist: " .. string.format("%.1f", dist or 0)
        else
            clickStatusLabel.Text = "Status: NO OBJ!"
            clickStatusLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
            State.autoClickEnabled = false
            return
        end
    end

    if State.teleportToClick then
        local tpTarget = State.currentTeleportTarget or State.currentClickObjRef
        local tpPos = getObjectPosition(tpTarget)
        if tpPos then
            local dist = getDistanceTo(tpPos)
            if dist > 10 then
                teleportTo(tpPos)
                clickTpLabel.Text = "TP to: " .. tpTarget.Name .. " ✓"
                clickTpLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
            end
        end
    end

    clickStatusLabel.Text = "Status: CLICKING"
    clickStatusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
    local clickCount = 0

    task.spawn(function()
        while State.autoClickEnabled do
            if State.currentClickObjRef and State.currentClickObjRef.Parent then
                local newRid = getReplicaIdFromObject(State.currentClickObjRef)
                if newRid and newRid ~= State.currentClickRid then
                    State.currentClickRid = newRid
                    clickRidLabel.Text = "RID: " .. tostring(newRid)
                end
                if State.teleportToClick then
                    local tpTarget = State.currentTeleportTarget or State.currentClickObjRef
                    local tpPos = getObjectPosition(tpTarget)
                    if tpPos then
                        local dist = getDistanceTo(tpPos)
                        clickDistLabel.Text = "Dist: " .. string.format("%.1f", dist)
                        if dist > 15 then teleportTo(tpPos) end
                    end
                end
                fireClick(State.currentClickRid)
                clickCount = clickCount + 1
                clickCountLabel.Text = "Clicks: " .. clickCount
            else
                clickStatusLabel.Text = "Status: Searching..."
                clickStatusLabel.TextColor3 = Color3.fromRGB(255, 200, 100)
                local clickObj, tpTarget, rid, name = findNearestClickObject(State.useVipPump)
                if clickObj and rid then
                    State.currentClickObjRef = clickObj
                    State.currentClickRid = rid
                    State.currentTeleportTarget = tpTarget
                    clickInfoLabel.Text = "Click: " .. tostring(name or clickObj.Name)
                    clickTpLabel.Text = "TP to: " .. (tpTarget and tpTarget.Name or "same")
                    clickRidLabel.Text = "RID: " .. tostring(rid)
                    clickStatusLabel.Text = "Status: CLICKING"
                    clickStatusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
                    if State.teleportToClick then
                        local tpPos = getObjectPosition(tpTarget or clickObj)
                        if tpPos then teleportTo(tpPos) end
                    end
                else
                    task.wait(1)
                    continue
                end
            end
            task.wait(State.clickDelay)
        end
    end)
end)

stopClickBtn.MouseButton1Click:Connect(function()
    State.autoClickEnabled = false
    clickStatusLabel.Text = "Status: STOPPED"
    clickStatusLabel.TextColor3 = Color3.fromRGB(255, 200, 100)
end)

-- KEYBIND
changeKeyBtn.MouseButton1Click:Connect(function()
    if waitingForKey then return end
    waitingForKey = true
    changeKeyBtn.Text = "🔑 Press key..."
    keybindLabel.Text = "Toggle: ..."
end)

minimizeBtn.MouseButton1Click:Connect(function()
    mainFrame.Visible = false
    miniButton.Visible = true
end)

miniButton.MouseButton1Click:Connect(function()
    mainFrame.Visible = true
    miniButton.Visible = false
end)

closeBtn.MouseButton1Click:Connect(function()
    mainFrame.Visible = false
    miniButton.Visible = false
end)

UserInputService.InputBegan:Connect(function(input, gp)
    if input.UserInputType ~= Enum.UserInputType.Keyboard then return end
    if waitingForKey then
        State.toggleKey = input.KeyCode
        waitingForKey = false
        keybindLabel.Text = "Toggle: " .. input.KeyCode.Name
        changeKeyBtn.Text = "🔑 Change Key"
        saveSettings()
        return
    end
    if gp then return end
    if input.KeyCode == State.toggleKey then
        if mainFrame.Visible then
            mainFrame.Visible = false
            miniButton.Visible = true
        elseif miniButton.Visible then
            mainFrame.Visible = true
            miniButton.Visible = false
        else
            mainFrame.Visible = true
        end
    end
end)

updateDrillInfo()
print("✅ Infinite Drill Simulator v2.8 loaded! Toggle: " .. State.toggleKey.Name)

Features & Information

⛏️ Infinite Drill Simulator 🗺️ Location Auto Detect Zone — automatically detects your zone and mine in real time Detect Once — one-time zone detection with a single click Manually select Zone / Mine using drop-down lists ⛏️ Mining Auto Mine — automatically mines all blocks in the selected mine Auto Claim — automatically claims a mine after clearing and waits for the next one Adjustable delay between hits (±0.05s) Displays the status, number of mined blocks, and claim progress 🖱️ Auto Click Automatically finds and clicks the nearest PowerClickArea Detect Nearest — manually searches for the nearest clickable object Teleport to ClickArea — teleports the character directly to the button VIP Pump Priority — prioritizes the VIP pump, if available Adjustable click delay (±0.01s) ⚙️ Other Custom keybind — any key to open/hide menu Collapsible window — minimize and close buttons Draggable interface
#Infinite Drill Simulator#Driil#Simulator#Infinite

Community Comments (1)

stehhawk846stehhawk846Mar 17, 2026

Thanks

More Scripts for Infinite Drill Simulator 🔥