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


-- LocalScript для автоматического бега и смерти (Auto-Die Script)
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local VirtualUser = game:GetService("VirtualUser")
local TweenService = game:GetService("TweenService")

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

-- Состояния скрипта
local targetCFrame = nil
local isRunning = false
local currentCost = 0
local targetCost = 0
local runSpeed = 32

-- Cost per death (-5000$)
local COST_PER_DEATH = 5000

-- ==================== ANTI-AFK ====================
player.Idled:Connect(function()
    VirtualUser:CaptureController()
    VirtualUser:ClickButton2(Vector2.new(0, 0))
end)

-- ==================== ИНТЕРФЕЙС (GUI) ====================
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AutoDieGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")

-- Главная рамка
local mainFrame = Instance.new("Frame")
mainFrame.Name = "MainFrame"
mainFrame.Size = UDim2.new(0, 320, 0, 420)
mainFrame.Position = UDim2.new(0.5, -160, 0.5, -210)
mainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 35)
mainFrame.BorderSizePixel = 0
mainFrame.Active = true
mainFrame.Draggable = true
mainFrame.Parent = screenGui

local frameCorner = Instance.new("UICorner")
frameCorner.CornerRadius = UDim.new(0, 12)
frameCorner.Parent = mainFrame

-- Заголовок
local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(1, -40, 0, 40)
titleLabel.Position = UDim2.new(0, 10, 0, 5)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "AUTO-DIE FARM"
titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
titleLabel.TextSize = 18
titleLabel.Font = Enum.Font.GothamBold
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Parent = mainFrame

-- Кнопка закрытия (сворачивания) в UI
local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0, 30, 0, 30)
closeBtn.Position = UDim2.new(1, -35, 0, 5)
closeBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
closeBtn.Text = "X"
closeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
closeBtn.Font = Enum.Font.GothamBold
closeBtn.TextSize = 14
closeBtn.Parent = mainFrame

local closeCorner = Instance.new("UICorner")
closeCorner.CornerRadius = UDim.new(0, 8)
closeCorner.Parent = closeBtn

-- 1. Выбор точки
local setPointBtn = Instance.new("TextButton")
setPointBtn.Size = UDim2.new(0.9, 0, 0, 35)
setPointBtn.Position = UDim2.new(0.05, 0, 0, 50)
setPointBtn.BackgroundColor3 = Color3.fromRGB(45, 45, 60)
setPointBtn.Text = "Установить точку смерти"
setPointBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
setPointBtn.Font = Enum.Font.GothamSemibold
setPointBtn.TextSize = 13
setPointBtn.Parent = mainFrame

local btnCorner1 = Instance.new("UICorner")
btnCorner1.CornerRadius = UDim.new(0, 8)
btnCorner1.Parent = setPointBtn

-- Status точки
local pointStatus = Instance.new("TextLabel")
pointStatus.Size = UDim2.new(0.9, 0, 0, 20)
pointStatus.Position = UDim2.new(0.05, 0, 0, 88)
pointStatus.BackgroundTransparency = 1
pointStatus.Text = "Точка: НЕ УСТАНОВЛЕНА"
pointStatus.TextColor3 = Color3.fromRGB(220, 80, 80)
pointStatus.Font = Enum.Font.Gotham
pointStatus.TextSize = 12
pointStatus.Parent = mainFrame

-- 2. Настройка скорости
local speedLabel = Instance.new("TextLabel")
speedLabel.Size = UDim2.new(0.9, 0, 0, 20)
speedLabel.Position = UDim2.new(0.05, 0, 0, 112)
speedLabel.BackgroundTransparency = 1
speedLabel.Text = "Скорость бега: 32"
speedLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
speedLabel.Font = Enum.Font.Gotham
speedLabel.TextSize = 12
speedLabel.Parent = mainFrame

local speedBox = Instance.new("TextBox")
speedBox.Size = UDim2.new(0.9, 0, 0, 30)
speedBox.Position = UDim2.new(0.05, 0, 0, 134)
speedBox.BackgroundColor3 = Color3.fromRGB(35, 35, 48)
speedBox.Text = "32"
speedBox.TextColor3 = Color3.fromRGB(255, 255, 255)
speedBox.Font = Enum.Font.Gotham
speedBox.TextSize = 13
speedBox.Parent = mainFrame

local speedCorner = Instance.new("UICorner")
speedCorner.CornerRadius = UDim.new(0, 6)
speedCorner.Parent = speedBox

-- 3. Выбор суммы
local amountLabel = Instance.new("TextLabel")
amountLabel.Size = UDim2.new(0.9, 0, 0, 20)
amountLabel.Position = UDim2.new(0.05, 0, 0, 172)
amountLabel.BackgroundTransparency = 1
amountLabel.Text = "Целевая сумма ($):"
amountLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
amountLabel.Font = Enum.Font.Gotham
amountLabel.TextSize = 12
amountLabel.Parent = mainFrame

-- Быстрые кнопки сумм
local btn250k = Instance.new("TextButton")
btn250k.Size = UDim2.new(0.28, 0, 0, 28)
btn250k.Position = UDim2.new(0.05, 0, 0, 195)
btn250k.BackgroundColor3 = Color3.fromRGB(45, 45, 60)
btn250k.Text = "250K"
btn250k.TextColor3 = Color3.fromRGB(255, 255, 255)
btn250k.Font = Enum.Font.GothamBold
btn250k.TextSize = 11
btn250k.Parent = mainFrame

local btn500k = Instance.new("TextButton")
btn500k.Size = UDim2.new(0.28, 0, 0, 28)
btn500k.Position = UDim2.new(0.36, 0, 0, 195)
btn500k.BackgroundColor3 = Color3.fromRGB(45, 45, 60)
btn500k.Text = "500K"
btn500k.TextColor3 = Color3.fromRGB(255, 255, 255)
btn500k.Font = Enum.Font.GothamBold
btn500k.TextSize = 11
btn500k.Parent = mainFrame

local btn1m = Instance.new("TextButton")
btn1m.Size = UDim2.new(0.28, 0, 0, 28)
btn1m.Position = UDim2.new(0.67, 0, 0, 195)
btn1m.BackgroundColor3 = Color3.fromRGB(45, 45, 60)
btn1m.Text = "1M"
btn1m.TextColor3 = Color3.fromRGB(255, 255, 255)
btn1m.Font = Enum.Font.GothamBold
btn1m.TextSize = 11
btn1m.Parent = mainFrame

for _, btn in ipairs({btn250k, btn500k, btn1m}) do
    local c = Instance.new("UICorner")
    c.CornerRadius = UDim.new(0, 6)
    c.Parent = btn
end

-- Поле для своей суммы
local customAmountBox = Instance.new("TextBox")
customAmountBox.Size = UDim2.new(0.9, 0, 0, 30)
customAmountBox.Position = UDim2.new(0.05, 0, 0, 230)
customAmountBox.BackgroundColor3 = Color3.fromRGB(35, 35, 48)
customAmountBox.PlaceholderText = "Или введите свою сумму..."
customAmountBox.Text = ""
customAmountBox.TextColor3 = Color3.fromRGB(255, 255, 255)
customAmountBox.Font = Enum.Font.Gotham
customAmountBox.TextSize = 12
customAmountBox.Parent = mainFrame

local customCorner = Instance.new("UICorner")
customCorner.CornerRadius = UDim.new(0, 6)
customCorner.Parent = customAmountBox

-- Прогресс и статус
local progressLabel = Instance.new("TextLabel")
progressLabel.Size = UDim2.new(0.9, 0, 0, 25)
progressLabel.Position = UDim2.new(0.05, 0, 0, 268)
progressLabel.BackgroundTransparency = 1
progressLabel.Text = "Потрачено: $0 / $0"
progressLabel.TextColor3 = Color3.fromRGB(0, 200, 255)
progressLabel.Font = Enum.Font.GothamBold
progressLabel.TextSize = 13
progressLabel.Parent = mainFrame

-- 4. Старт / Стоп
local toggleBtn = Instance.new("TextButton")
toggleBtn.Size = UDim2.new(0.9, 0, 0, 42)
toggleBtn.Position = UDim2.new(0.05, 0, 0, 300)
toggleBtn.BackgroundColor3 = Color3.fromRGB(50, 180, 90)
toggleBtn.Text = "СТАРТ"
toggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleBtn.Font = Enum.Font.GothamBold
toggleBtn.TextSize = 16
toggleBtn.Parent = mainFrame

local toggleCorner = Instance.new("UICorner")
toggleCorner.CornerRadius = UDim.new(0, 8)
toggleCorner.Parent = toggleBtn

-- Подсказка про клавишу
local hintLabel = Instance.new("TextLabel")
hintLabel.Size = UDim2.new(0.9, 0, 0, 20)
hintLabel.Position = UDim2.new(0.05, 0, 0, 350)
hintLabel.BackgroundTransparency = 1
hintLabel.Text = "[RightShift] — Скрыть / Показать UI"
hintLabel.TextColor3 = Color3.fromRGB(120, 120, 140)
hintLabel.Font = Enum.Font.Gotham
hintLabel.TextSize = 11
hintLabel.Parent = mainFrame

-- Маленькая кнопка для открытия UI (если скрыли через Х)
local openBtn = Instance.new("TextButton")
openBtn.Name = "OpenGuiButton"
openBtn.Size = UDim2.new(0, 100, 0, 30)
openBtn.Position = UDim2.new(0, 10, 1, -40)
openBtn.BackgroundColor3 = Color3.fromRGB(25, 25, 35)
openBtn.Text = "Открыть UI"
openBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
openBtn.Font = Enum.Font.GothamBold
openBtn.TextSize = 12
openBtn.Visible = false
openBtn.Parent = screenGui

local openCorner = Instance.new("UICorner")
openCorner.CornerRadius = UDim.new(0, 8)
openCorner.Parent = openBtn

-- ==================== ЛОГИКА И СОБЫТИЯ ====================

-- Скрытие/Показ GUI
local function toggleGuiVisibility()
    mainFrame.Visible = not mainFrame.Visible
    openBtn.Visible = not mainFrame.Visible
end

closeBtn.MouseButton1Click:Connect(toggleGuiVisibility)
openBtn.MouseButton1Click:Connect(toggleGuiVisibility)

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if not gameProcessed and input.KeyCode == Enum.KeyCode.RightShift then
        toggleGuiVisibility()
    end
end)

-- Обновление персонажа при респавне
player.CharacterAdded:Connect(function(newChar)
    character = newChar
    humanoid = character:WaitForChild("Humanoid")
end)

-- Установка точки
setPointBtn.MouseButton1Click:Connect(function()
    if character and character:FindFirstChild("HumanoidRootPart") then
        targetCFrame = character.HumanoidRootPart.CFrame
        pointStatus.Text = "Точка: УСТАНОВЛЕНА"
        pointStatus.TextColor3 = Color3.fromRGB(80, 220, 80)
    end
end)

-- Ввод скорости
speedBox.FocusLost:Connect(function()
    local val = tonumber(speedBox.Text)
    if val and val > 0 then
        runSpeed = val
        speedLabel.Text = "Скорость бега: " .. tostring(runSpeed)
    else
        speedBox.Text = tostring(runSpeed)
    end
end)

-- Установка сумм
local function setTargetAmount(val)
    targetCost = val
    customAmountBox.Text = tostring(val)
    progressLabel.Text = string.format("Потрачено: $%d / $%d", currentCost, targetCost)
end

btn250k.MouseButton1Click:Connect(function() setTargetAmount(250000) end)
btn500k.MouseButton1Click:Connect(function() setTargetAmount(500000) end)
btn1m.MouseButton1Click:Connect(function() setTargetAmount(1000000) end)

customAmountBox.FocusLost:Connect(function()
    local val = tonumber(customAmountBox.Text)
    if val and val >= 0 then
        targetCost = val
        progressLabel.Text = string.format("Потрачено: $%d / $%d", currentCost, targetCost)
    end
end)

-- Основной цикл забега
local function startRunningLoop()
    task.spawn(function()
        while isRunning and currentCost < targetCost do
            if not targetCFrame then
                pointStatus.Text = "ОШИБКА: Задайте точку!"
                isRunning = false
                toggleBtn.Text = "СТАРТ"
                toggleBtn.BackgroundColor3 = Color3.fromRGB(50, 180, 90)
                break
            end

            -- Ожидание появления персонажа
            local char = player.Character or player.CharacterAdded:Wait()
            local hum = char:WaitForChild("Humanoid", 5)
            local hrp = char:WaitForChild("HumanoidRootPart", 5)

            if hum and hrp then
                hum.WalkSpeed = runSpeed
                
                -- Идем к точке
                hum:MoveTo(targetCFrame.Position)

                -- Ждем пока дойдет или умрет
                local reached = false
                local conn
                conn = hum.MoveToFinished:Connect(function()
                    reached = true
                    if conn then conn:Disconnect() end
                end)

                while isRunning and hum.Health > 0 and (hrp.Position - targetCFrame.Position).Magnitude > 4 do
                    hum:MoveTo(targetCFrame.Position)
                    task.wait(0.2)
                end

                if conn then conn:Disconnect() end

                -- Если персонаж жив и на месте, а смерть не наступила от внешних факторов
                if isRunning and hum.Health > 0 then
                    -- Учитываем смерть и обновляем счетчик
                    currentCost = currentCost + COST_PER_DEATH
                    progressLabel.Text = string.format("Потрачено: $%d / $%d", currentCost, targetCost)

                    -- Убиваем персонажа для перезапуска
                    hum.Health = 0
                end
            end

            -- Пауза на время возрождения (спавна)
            task.wait(2)
        end

        -- Завершение работы
        if isRunning then
            isRunning = false
            toggleBtn.Text = "СТАРТ"
            toggleBtn.BackgroundColor3 = Color3.fromRGB(50, 180, 90)
            if currentCost >= targetCost and targetCost > 0 then
                progressLabel.Text = "ГОТОВО! Цель достигнута."
            end
        end
    end)
end

-- Переключение старт/стоп
toggleBtn.MouseButton1Click:Connect(function()
    if not isRunning then
        if not targetCFrame then
            pointStatus.Text = "ОШИБКА: Задайте точку!"
            return
        end
        if targetCost <= 0 then
            progressLabel.Text = "Укажите сумму > 0!"
            return
        end

        isRunning = true
        toggleBtn.Text = "СТОП"
        toggleBtn.BackgroundColor3 = Color3.fromRGB(200, 60, 60)
        startRunningLoop()
    else
        isRunning = false
        toggleBtn.Text = "СТАРТ"
        toggleBtn.BackgroundColor3 = Color3.fromRGB(50, 180, 90)
    end
end)