Загрузка данных


-- // BoatHelper | Premium Script
-- // Создано для Roblox

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")

-- // Функции, которые будут отключаться при уничтожении GUI
local ActiveFunctions = {
    ESP = {
        Enabled = false,
        Connection = nil,
        PlayersData = {},
        Name = "ESP Игроков",
        Description = "Подсвечивает игроков через стены и показывает их ник, расстояние и здоровье."
    },
    Aimbot = {
        Enabled = false,
        Connection = nil,
        IgnoredPlayers = {}, -- Список игнорируемых игроков
        Name = "Aimbot",
        Description = "Автоматически наводится на ближайшего игрока в голову."
    }
}

-- // Окно выбора игроков для игнорирования
local IgnoreListFrame = nil
local SelectedIgnorePlayer = nil

-- // Очистка ESP для конкретного игрока
local function CleanupPlayerESP(player)
    local data = ActiveFunctions.ESP.PlayersData[player]
    if not data then return end
    
    if data.Highlight then
        data.Highlight:Destroy()
        data.Highlight = nil
    end
    
    if data.Billboard then
        data.Billboard:Destroy()
        data.Billboard = nil
    end
    
    if data.UpdateConnection then
        data.UpdateConnection:Disconnect()
        data.UpdateConnection = nil
    end
    
    if data.CharacterConnection then
        data.CharacterConnection:Disconnect()
        data.CharacterConnection = nil
    end
    
    ActiveFunctions.ESP.PlayersData[player] = nil
end

-- // Создание ESP для игрока
local function SetupPlayerESP(player)
    if player == Player then return end
    
    CleanupPlayerESP(player)
    
    ActiveFunctions.ESP.PlayersData[player] = {
        Highlight = nil,
        Billboard = nil,
        UpdateConnection = nil,
        CharacterConnection = nil
    }
    
    local function CreateESPVisuals(character)
        if not character or not ActiveFunctions.ESP.Enabled then return end
        
        local data = ActiveFunctions.ESP.PlayersData[player]
        if not data then return end
        
        if data.Highlight then
            data.Highlight:Destroy()
            data.Highlight = nil
        end
        if data.Billboard then
            data.Billboard:Destroy()
            data.Billboard = nil
        end
        if data.UpdateConnection then
            data.UpdateConnection:Disconnect()
            data.UpdateConnection = nil
        end
        
        local humanoidRootPart = character:WaitForChild("HumanoidRootPart", 5)
        local humanoid = character:WaitForChild("Humanoid", 5)
        
        if not humanoidRootPart or not humanoid then return end
        
        local highlight = Instance.new("Highlight")
        highlight.Name = "ESP_Highlight"
        highlight.FillColor = Color3.fromRGB(255, 255, 255)
        highlight.FillTransparency = 0.5
        highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
        highlight.OutlineTransparency = 0
        highlight.Adornee = character
        highlight.Parent = character
        data.Highlight = highlight
        
        local billboard = Instance.new("BillboardGui")
        billboard.Name = "ESP_Billboard"
        billboard.Adornee = humanoidRootPart
        billboard.Parent = character
        billboard.Size = UDim2.new(0, 300, 0, 30)
        billboard.StudsOffset = Vector3.new(0, 3, 0)
        billboard.AlwaysOnTop = true
        billboard.MaxDistance = 1000
        
        local textLabel = Instance.new("TextLabel")
        textLabel.Parent = billboard
        textLabel.Size = UDim2.new(1, 0, 1, 0)
        textLabel.BackgroundTransparency = 1
        textLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
        textLabel.Font = Enum.Font.GothamBold
        textLabel.TextSize = 14
        textLabel.TextStrokeTransparency = 0.3
        textLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
        textLabel.Text = "Загрузка..."
        data.Billboard = billboard
        
        local function UpdateInfo()
            if not ActiveFunctions.ESP.Enabled then return end
            if not player.Parent then return end
            
            local localPlayer = Player
            local localCharacter = localPlayer.Character
            if not localCharacter then return end
            
            local localRoot = localCharacter:FindFirstChild("HumanoidRootPart")
            if not localRoot then return end
            
            local targetCharacter = player.Character
            if not targetCharacter then return end
            
            local targetRoot = targetCharacter:FindFirstChild("HumanoidRootPart")
            local targetHumanoid = targetCharacter:FindFirstChild("Humanoid")
            
            if not targetRoot or not targetHumanoid then
                textLabel.Text = player.DisplayName or player.Name
                return
            end
            
            local distance = (targetRoot.Position - localRoot.Position).Magnitude
            local health = math.floor(targetHumanoid.Health)
            
            textLabel.Text = string.format("%s | %.0fstuds | %dHP", 
                player.DisplayName or player.Name, 
                distance, 
                health
            )
        end
        
        data.UpdateConnection = RunService.Heartbeat:Connect(function()
            if not ActiveFunctions.ESP.Enabled then
                if data.UpdateConnection then
                    data.UpdateConnection:Disconnect()
                    data.UpdateConnection = nil
                end
                return
            end
            UpdateInfo()
        end)
    end
    
    local function OnCharacterAdded(character)
        if ActiveFunctions.ESP.Enabled then
            CreateESPVisuals(character)
        end
    end
    
    if player.Character then
        CreateESPVisuals(player.Character)
    end
    
    local data = ActiveFunctions.ESP.PlayersData[player]
    if data then
        data.CharacterConnection = player.CharacterAdded:Connect(OnCharacterAdded)
    end
end

-- // Сканирование всех игроков для ESP
local function ScanAllPlayers()
    for _, player in pairs(Players:GetPlayers()) do
        if player ~= Player then
            SetupPlayerESP(player)
        end
    end
end

-- // Очистка всего ESP
local function ClearAllESP()
    for player, _ in pairs(ActiveFunctions.ESP.PlayersData) do
        CleanupPlayerESP(player)
    end
    ActiveFunctions.ESP.PlayersData = {}
end

-- // Aimbot - поиск ближайшего игрока (с учетом игнорируемых)
local function GetClosestPlayer()
    local closestPlayer = nil
    local shortestDistance = math.huge
    
    local localCharacter = Player.Character
    if not localCharacter then return nil end
    
    local localRoot = localCharacter:FindFirstChild("HumanoidRootPart")
    if not localRoot then return nil end
    
    for _, targetPlayer in pairs(Players:GetPlayers()) do
        if targetPlayer ~= Player 
            and targetPlayer.Character 
            and not ActiveFunctions.Aimbot.IgnoredPlayers[targetPlayer.UserId] then
            
            local targetHumanoid = targetPlayer.Character:FindFirstChild("Humanoid")
            local targetRoot = targetPlayer.Character:FindFirstChild("HumanoidRootPart")
            
            if targetHumanoid and targetRoot and targetHumanoid.Health > 0 then
                local distance = (localRoot.Position - targetRoot.Position).Magnitude
                if distance < shortestDistance then
                    shortestDistance = distance
                    closestPlayer = targetPlayer
                end
            end
        end
    end
    
    return closestPlayer
end

-- // Aimbot - наведение на цель
local function AimAtTarget()
    local target = GetClosestPlayer()
    if not target then return end
    
    local localCharacter = Player.Character
    if not localCharacter then return end
    
    local targetCharacter = target.Character
    if not targetCharacter then return end
    
    local targetHead = targetCharacter:FindFirstChild("Head")
    if not targetHead then return end
    
    local targetPosition = targetHead.Position
    
    local camera = Workspace.CurrentCamera
    if not camera then return end
    
    local cameraPosition = camera.CFrame.Position
    local lookAt = CFrame.new(cameraPosition, targetPosition)
    
    camera.CFrame = camera.CFrame:Lerp(lookAt, 0.3)
end

-- // Создание окна выбора игроков для игнорирования
local function CreateIgnoreListWindow(mainFrame)
    if IgnoreListFrame then
        IgnoreListFrame:Destroy()
    end
    
    IgnoreListFrame = Instance.new("Frame")
    IgnoreListFrame.Name = "IgnoreListFrame"
    IgnoreListFrame.Parent = mainFrame.Parent
    IgnoreListFrame.Size = UDim2.new(0, 250, 0, 300)
    IgnoreListFrame.Position = UDim2.new(0.5, 180, 0.5, -150)
    IgnoreListFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
    IgnoreListFrame.BorderSizePixel = 1
    IgnoreListFrame.BorderColor3 = Color3.fromRGB(60, 60, 60)
    IgnoreListFrame.Active = true
    IgnoreListFrame.Visible = true
    
    -- Заголовок
    local TitleBar2 = Instance.new("Frame")
    TitleBar2.Name = "TitleBar"
    TitleBar2.Parent = IgnoreListFrame
    TitleBar2.Size = UDim2.new(1, 0, 0, 25)
    TitleBar2.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
    TitleBar2.BorderSizePixel = 1
    TitleBar2.BorderColor3 = Color3.fromRGB(60, 60, 60)
    
    local TitleText2 = Instance.new("TextLabel")
    TitleText2.Parent = TitleBar2
    TitleText2.Size = UDim2.new(1, -30, 1, 0)
    TitleText2.Position = UDim2.new(0, 10, 0, 0)
    TitleText2.BackgroundTransparency = 1
    TitleText2.Text = "Игнорируемые игроки"
    TitleText2.TextColor3 = Color3.fromRGB(200, 200, 200)
    TitleText2.Font = Enum.Font.GothamBold
    TitleText2.TextSize = 13
    TitleText2.TextXAlignment = Enum.TextXAlignment.Left
    
    -- Кнопка закрыть
    local CloseButton = Instance.new("TextButton")
    CloseButton.Parent = TitleBar2
    CloseButton.Size = UDim2.new(0, 20, 0, 20)
    CloseButton.Position = UDim2.new(1, -25, 0, 2)
    CloseButton.BackgroundColor3 = Color3.fromRGB(150, 30, 30)
    CloseButton.BorderSizePixel = 1
    CloseButton.BorderColor3 = Color3.fromRGB(100, 100, 100)
    CloseButton.Text = "X"
    CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    CloseButton.Font = Enum.Font.GothamBold
    CloseButton.TextSize = 14
    CloseButton.AutoButtonColor = false
    
    CloseButton.MouseButton1Click:Connect(function()
        IgnoreListFrame:Destroy()
        IgnoreListFrame = nil
    end)
    
    -- Контейнер со списком игроков
    local ScrollingFrame = Instance.new("ScrollingFrame")
    ScrollingFrame.Parent = IgnoreListFrame
    ScrollingFrame.Size = UDim2.new(1, -20, 1, -70)
    ScrollingFrame.Position = UDim2.new(0, 10, 0, 35)
    ScrollingFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
    ScrollingFrame.BorderSizePixel = 1
    ScrollingFrame.BorderColor3 = Color3.fromRGB(60, 60, 60)
    ScrollingFrame.ScrollBarThickness = 5
    ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
    
    local UIListLayout = Instance.new("UIListLayout")
    UIListLayout.Parent = ScrollingFrame
    UIListLayout.SortOrder = Enum.SortOrder.Name
    UIListLayout.Padding = UDim.new(0, 2)
    
    -- Кнопка обновления списка
    local RefreshButton = Instance.new("TextButton")
    RefreshButton.Parent = IgnoreListFrame
    RefreshButton.Size = UDim2.new(1, -20, 0, 25)
    RefreshButton.Position = UDim2.new(0, 10, 1, -35)
    RefreshButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
    RefreshButton.BorderSizePixel = 1
    RefreshButton.BorderColor3 = Color3.fromRGB(100, 100, 100)
    RefreshButton.Text = "Обновить список"
    RefreshButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    RefreshButton.Font = Enum.Font.Gotham
    RefreshButton.TextSize = 12
    RefreshButton.AutoButtonColor = false
    
    RefreshButton.MouseEnter:Connect(function()
        RefreshButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
    end)
    RefreshButton.MouseLeave:Connect(function()
        RefreshButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
    end)
    
    -- Функция обновления списка игроков
    local function UpdatePlayerList()
        -- Очищаем список
        for _, child in pairs(ScrollingFrame:GetChildren()) do
            if child:IsA("Frame") then
                child:Destroy()
            end
        end
        
        local yOffset = 0
        
        for _, targetPlayer in pairs(Players:GetPlayers()) do
            if targetPlayer ~= Player then
                local isIgnored = ActiveFunctions.Aimbot.IgnoredPlayers[targetPlayer.UserId] or false
                
                local PlayerRow = Instance.new("Frame")
                PlayerRow.Parent = ScrollingFrame
                PlayerRow.Size = UDim2.new(1, 0, 0, 25)
                PlayerRow.BackgroundColor3 = isIgnored and Color3.fromRGB(120, 40, 40) or Color3.fromRGB(50, 50, 50)
                PlayerRow.BorderSizePixel = 1
                PlayerRow.BorderColor3 = Color3.fromRGB(80, 80, 80)
                
                local PlayerName = Instance.new("TextLabel")
                PlayerName.Parent = PlayerRow
                PlayerName.Size = UDim2.new(1, -80, 1, 0)
                PlayerName.Position = UDim2.new(0, 5, 0, 0)
                PlayerName.BackgroundTransparency = 1
                PlayerName.Text = targetPlayer.DisplayName or targetPlayer.Name
                PlayerName.TextColor3 = Color3.fromRGB(255, 255, 255)
                PlayerName.Font = Enum.Font.Gotham
                PlayerName.TextSize = 12
                PlayerName.TextXAlignment = Enum.TextXAlignment.Left
                
                local ToggleIgnore = Instance.new("TextButton")
                ToggleIgnore.Parent = PlayerRow
                ToggleIgnore.Size = UDim2.new(0, 70, 0, 20)
                ToggleIgnore.Position = UDim2.new(1, -75, 0, 2)
                ToggleIgnore.BackgroundColor3 = isIgnored and Color3.fromRGB(30, 150, 30) or Color3.fromRGB(150, 30, 30)
                ToggleIgnore.BorderSizePixel = 1
                ToggleIgnore.BorderColor3 = Color3.fromRGB(100, 100, 100)
                ToggleIgnore.Text = isIgnored and "Убрать" or "Игнорить"
                ToggleIgnore.TextColor3 = Color3.fromRGB(255, 255, 255)
                ToggleIgnore.Font = Enum.Font.GothamBold
                ToggleIgnore.TextSize = 10
                ToggleIgnore.AutoButtonColor = false
                
                ToggleIgnore.MouseButton1Click:Connect(function()
                    if ActiveFunctions.Aimbot.IgnoredPlayers[targetPlayer.UserId] then
                        -- Убираем из игнора
                        ActiveFunctions.Aimbot.IgnoredPlayers[targetPlayer.UserId] = nil
                        ToggleIgnore.BackgroundColor3 = Color3.fromRGB(150, 30, 30)
                        ToggleIgnore.Text = "Игнорить"
                        PlayerRow.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
                        print("BoatHelper: " .. targetPlayer.Name .. " убран из игнорирования")
                    else
                        -- Добавляем в игнор
                        ActiveFunctions.Aimbot.IgnoredPlayers[targetPlayer.UserId] = true
                        ToggleIgnore.BackgroundColor3 = Color3.fromRGB(30, 150, 30)
                        ToggleIgnore.Text = "Убрать"
                        PlayerRow.BackgroundColor3 = Color3.fromRGB(120, 40, 40)
                        print("BoatHelper: " .. targetPlayer.Name .. " добавлен в игнорирование")
                    end
                end)
                
                yOffset = yOffset + 27
            end
        end
        
        ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, yOffset)
    end
    
    RefreshButton.MouseButton1Click:Connect(function()
        UpdatePlayerList()
    end)
    
    -- Перетаскивание окна игнора
    local draggingIgnore = false
    local dragStartIgnore, startPosIgnore
    
    TitleBar2.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            draggingIgnore = true
            dragStartIgnore = input.Position
            startPosIgnore = IgnoreListFrame.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    draggingIgnore = false
                end
            end)
        end
    end)
    
    TitleBar2.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement and draggingIgnore then
            local delta = input.Position - dragStartIgnore
            IgnoreListFrame.Position = UDim2.new(startPosIgnore.X.Scale, startPosIgnore.X.Offset + delta.X, startPosIgnore.Y.Scale, startPosIgnore.Y.Offset + delta.Y)
        end
    end)
    
    UpdatePlayerList()
end

-- // Создание GUI
local function CreateBoatHelper()
    local ScreenGui = Instance.new("ScreenGui")
    ScreenGui.Name = "BoatHelper"
    ScreenGui.Parent = Player:WaitForChild("PlayerGui")
    ScreenGui.ResetOnSpawn = false
    ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling

    local MainFrame = Instance.new("Frame")
    MainFrame.Name = "MainFrame"
    MainFrame.Parent = ScreenGui
    MainFrame.Size = UDim2.new(0, 320, 0, 200)
    MainFrame.Position = UDim2.new(0.5, -160, 0.5, -100)
    MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
    MainFrame.BorderSizePixel = 1
    MainFrame.BorderColor3 = Color3.fromRGB(60, 60, 60)
    MainFrame.Active = true

    local TitleBar = Instance.new("Frame")
    TitleBar.Name = "TitleBar"
    TitleBar.Parent = MainFrame
    TitleBar.Size = UDim2.new(1, 0, 0, 30)
    TitleBar.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
    TitleBar.BorderSizePixel = 1
    TitleBar.BorderColor3 = Color3.fromRGB(60, 60, 60)

    local TitleText = Instance.new("TextLabel")
    TitleText.Parent = TitleBar
    TitleText.Size = UDim2.new(1, -10, 1, 0)
    TitleText.Position = UDim2.new(0, 10, 0, 0)
    TitleText.BackgroundTransparency = 1
    TitleText.Text = "BoatHelper"
    TitleText.TextColor3 = Color3.fromRGB(200, 200, 200)
    TitleText.Font = Enum.Font.GothamBold
    TitleText.TextSize = 14
    TitleText.TextXAlignment = Enum.TextXAlignment.Left

    local Divider1 = Instance.new("Frame")
    Divider1.Parent = MainFrame
    Divider1.Size = UDim2.new(1, 0, 0, 1)
    Divider1.Position = UDim2.new(0, 0, 0, 30)
    Divider1.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
    Divider1.BorderSizePixel = 0

    -- // Функция создания строки с функцией
    local function CreateFunctionRow(yPos, funcData, toggleCallback, hasSettings)
        local Container = Instance.new("Frame")
        Container.Parent = MainFrame
        Container.Size = UDim2.new(1, -20, 0, 40)
        Container.Position = UDim2.new(0, 10, 0, yPos)
        Container.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
        Container.BorderSizePixel = 1
        Container.BorderColor3 = Color3.fromRGB(60, 60, 60)

        local FuncInfo = Instance.new("TextLabel")
        FuncInfo.Parent = Container
        FuncInfo.Size = UDim2.new(1, hasSettings and -110 or -60, 1, 0)
        FuncInfo.Position = UDim2.new(0, 10, 0, 0)
        FuncInfo.BackgroundTransparency = 1
        FuncInfo.Text = funcData.Name .. "\n" .. funcData.Description
        FuncInfo.TextColor3 = Color3.fromRGB(180, 180, 180)
        FuncInfo.Font = Enum.Font.Gotham
        FuncInfo.TextSize = 11
        FuncInfo.TextXAlignment = Enum.TextXAlignment.Left
        FuncInfo.TextYAlignment = Enum.TextYAlignment.Center
        FuncInfo.TextWrapped = true

        -- Кнопка настроек (если есть)
        local SettingsButton
        if hasSettings then
            SettingsButton = Instance.new("TextButton")
            SettingsButton.Parent = Container
            SettingsButton.Size = UDim2.new(0, 40, 0, 20)
            SettingsButton.Position = UDim2.new(1, -100, 0.5, -10)
            SettingsButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
            SettingsButton.BorderSizePixel = 1
            SettingsButton.BorderColor3 = Color3.fromRGB(100, 100, 100)
            SettingsButton.Text = "Настр"
            SettingsButton.TextColor3 = Color3.fromRGB(255, 255, 255)
            SettingsButton.Font = Enum.Font.Gotham
            SettingsButton.TextSize = 10
            SettingsButton.AutoButtonColor = false
            
            SettingsButton.MouseEnter:Connect(function()
                SettingsButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
            end)
            SettingsButton.MouseLeave:Connect(function()
                SettingsButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
            end)
        end

        local ToggleButton = Instance.new("TextButton")
        ToggleButton.Name = "ToggleButton"
        ToggleButton.Parent = Container
        ToggleButton.Size = UDim2.new(0, 40, 0, 20)
        ToggleButton.Position = UDim2.new(1, -50, 0.5, -10)
        ToggleButton.BackgroundColor3 = Color3.fromRGB(150, 30, 30)
        ToggleButton.BorderSizePixel = 1
        ToggleButton.BorderColor3 = Color3.fromRGB(100, 100, 100)
        ToggleButton.Text = "OFF"
        ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
        ToggleButton.Font = Enum.Font.GothamBold
        ToggleButton.TextSize = 11
        ToggleButton.AutoButtonColor = false

        local function UpdateButtonState()
            if funcData.Enabled then
                ToggleButton.BackgroundColor3 = Color3.fromRGB(30, 150, 30)
                ToggleButton.Text = "ON"
            else
                ToggleButton.BackgroundColor3 = Color3.fromRGB(150, 30, 30)
                ToggleButton.Text = "OFF"
            end
        end

        ToggleButton.MouseButton1Click:Connect(function()
            funcData.Enabled = not funcData.Enabled
            UpdateButtonState()
            if toggleCallback then
                toggleCallback(funcData.Enabled)
            end
        end)

        return Container, ToggleButton, UpdateButtonState, SettingsButton
    end

    -- // Создаем строку для ESP
    local espContainer, espToggle, espUpdate = CreateFunctionRow(45, ActiveFunctions.ESP, function(enabled)
        if enabled then
            print("BoatHelper: ESP ВКЛЮЧЕН")
            ScanAllPlayers()
            
            ActiveFunctions.ESP.Connection = Players.PlayerAdded:Connect(function(newPlayer)
                if ActiveFunctions.ESP.Enabled and newPlayer ~= Player then
                    SetupPlayerESP(newPlayer)
                end
            end)
            
            Players.PlayerRemoving:Connect(function(leavingPlayer)
                if ActiveFunctions.ESP.PlayersData[leavingPlayer] then
                    CleanupPlayerESP(leavingPlayer)
                end
            end)
        else
            print("BoatHelper: ESP ВЫКЛЮЧЕН")
            if ActiveFunctions.ESP.Connection then
                ActiveFunctions.ESP.Connection:Disconnect()
                ActiveFunctions.ESP.Connection = nil
            end
            ClearAllESP()
        end
    end, false)

    -- // Разделитель между функциями
    local DividerBetween = Instance.new("Frame")
    DividerBetween.Parent = MainFrame
    DividerBetween.Size = UDim2.new(1, 0, 0, 1)
    DividerBetween.Position = UDim2.new(0, 0, 0, 95)
    DividerBetween.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
    DividerBetween.BorderSizePixel = 0

    -- // Создаем строку для Aimbot с кнопкой настроек
    local aimbotContainer, aimbotToggle, aimbotUpdate, settingsButton = CreateFunctionRow(105, ActiveFunctions.Aimbot, function(enabled)
        if enabled then
            print("BoatHelper: Aimbot ВКЛЮЧЕН")
            ActiveFunctions.Aimbot.Connection = RunService.RenderStepped:Connect(function()
                if ActiveFunctions.Aimbot.Enabled then
                    AimAtTarget()
                end
            end)
        else
            print("BoatHelper: Aimbot ВЫКЛЮЧЕН")
            if ActiveFunctions.Aimbot.Connection then
                ActiveFunctions.Aimbot.Connection:Disconnect()
                ActiveFunctions.Aimbot.Connection = nil
            end
        end
    end, true)

    -- Обработчик кнопки настроек Aimbot
    if settingsButton then
        settingsButton.MouseButton1Click:Connect(function()
            CreateIgnoreListWindow(MainFrame)
        end)
    end

    -- // Разделитель перед кнопкой Destroy
    local Divider2 = Instance.new("Frame")
    Divider2.Parent = MainFrame
    Divider2.Size = UDim2.new(1, 0, 0, 1)
    Divider2.Position = UDim2.new(0, 0, 0, 155)
    Divider2.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
    Divider2.BorderSizePixel = 0

    -- // Кнопка DestroyGUI
    local DestroyButton = Instance.new("TextButton")
    DestroyButton.Name = "DestroyButton"
    DestroyButton.Parent = MainFrame
    DestroyButton.Size = UDim2.new(1, -20, 0, 30)
    DestroyButton.Position = UDim2.new(0, 10, 1, -40)
    DestroyButton.BackgroundColor3 = Color3.fromRGB(120, 20, 20)
    DestroyButton.BorderSizePixel = 1
    DestroyButton.BorderColor3 = Color3.fromRGB(60, 60, 60)
    DestroyButton.Text = "DestroyGUI"
    DestroyButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    DestroyButton.Font = Enum.Font.GothamBold
    DestroyButton.TextSize = 13
    DestroyButton.AutoButtonColor = false

    DestroyButton.MouseEnter:Connect(function()
        DestroyButton.BackgroundColor3 = Color3.fromRGB(160, 30, 30)
    end)
    DestroyButton.MouseLeave:Connect(function()
        DestroyButton.BackgroundColor3 = Color3.fromRGB(120, 20, 20)
    end)

    -- // Логика перетаскивания
    local dragging = false
    local dragInput, dragStart, startPos

    TitleBar.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = true
            dragStart = input.Position
            startPos = MainFrame.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    dragging = false
                end
            end)
        end
    end)

    TitleBar.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
            local delta = input.Position - dragStart
            MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
        end
    end)

    -- // Открытие/закрытие по Insert
    local function ToggleVisibility()
        MainFrame.Visible = not MainFrame.Visible
        if IgnoreListFrame then
            IgnoreListFrame.Visible = MainFrame.Visible
        end
    end

    UserInputService.InputBegan:Connect(function(input, gameProcessed)
        if gameProcessed then return end
        if input.KeyCode == Enum.KeyCode.Insert then
            ToggleVisibility()
        end
    end)

    -- // Логика уничтожения GUI и всех функций
    DestroyButton.MouseButton1Click:Connect(function()
        for funcName, funcData in pairs(ActiveFunctions) do
            if funcData.Connection then
                funcData.Connection:Disconnect()
                funcData.Connection = nil
            end
            if funcName == "ESP" then
                ClearAllESP()
            end
            funcData.Enabled = false
            print("BoatHelper: Функция '" .. funcName .. "' отключена при уничтожении GUI.")
        end
        
        if IgnoreListFrame then
            IgnoreListFrame:Destroy()
            IgnoreListFrame = nil
        end

        ScreenGui:Destroy()
        print("BoatHelper: GUI успешно уничтожен.")
    end)

    espUpdate()
    aimbotUpdate()
    
    print("BoatHelper: Меню загружено и готово к работе.")
    print("BoatHelper: Используйте Insert для открытия/закрытия меню.")
    print("BoatHelper: Кнопка 'Настр' в Aimbot открывает список игнорирования.")
end

CreateBoatHelper()