local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Workspace = game:GetService("Workspace") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() -- Настройки local AUTO_COLLECT = false local COLLECT_DISTANCE = 30 local COLLECT_DELAY = 0 -- Минимальная задержка между сборами -- Находим RemoteEvent для сбора local eventsFolder = ReplicatedStorage:FindFirstChild("Events") or ReplicatedStorage:FindFirstChild("Remotes") local Pickup = eventsFolder and eventsFolder:FindFirstChild("Pickup") -- Список ресурсов для сбора local RESOURCES_TO_COLLECT = { "Chaos Sphere", "Unknown Soul", "Angel Soul", "Aqua Soul", "Collapse Sphere", "Fire Soul", "Unknown Stone", "God Key", "Heaven Leaves", "Spirit Key", "Heaven Log", "Void Shard", "Onyx", "Demon Shard", "Gold Bar", "Aqua Bar", "??? Key", "Dark Stone", "Jade", "Heaven Bar", "Roman Log", "Roman Crystal", "Bone Bar", "Essence", "Raw Gold", "Crystal Chunk", "OP Essence", "OMEGA Essence", "ULTRA Essence", "Dark Stack" } -- Создаем таблицу для быстрой проверки ресурсов local RESOURCES_LOOKUP = {} for _, resource in ipairs(RESOURCES_TO_COLLECT) do RESOURCES_LOOKUP[resource] = true end -- Создаем интерфейс local screenGui = Instance.new("ScreenGui") screenGui.Name = "AutoCollectUI" screenGui.Parent = player.PlayerGui screenGui.ResetOnSpawn = false local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 180, 0, 40) frame.Position = UDim2.new(1, -190, 0, 120) frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) frame.BorderSizePixel = 0 frame.Parent = screenGui local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 6) corner.Parent = frame local statusText = Instance.new("TextLabel") statusText.Size = UDim2.new(1, 0, 1, 0) statusText.BackgroundTransparency = 1 statusText.Text = "Авто-сбор: ВЫКЛ" statusText.TextColor3 = Color3.fromRGB(255, 50, 50) statusText.Font = Enum.Font.GothamBold statusText.TextSize = 14 statusText.Parent = frame -- Переменные для управления очередью сбора local isCollecting = false local resourceQueue = {} local currentResourceIndex = 1 -- Функция обновления интерфейса local function updateUI() if AUTO_COLLECT then statusText.Text = "Авто-сбор: ВКЛ" statusText.TextColor3 = Color3.fromRGB(50, 255, 50) else statusText.Text = "Авто-сбор: ВЫКЛ" statusText.TextColor3 = Color3.fromRGB(255, 50, 50) end end -- Функция для обновления персонажа local function updateCharacter() character = player.Character or player.CharacterAdded:Wait() end -- Слушаем изменение персонажа player.CharacterAdded:Connect(function(newCharacter) character = newCharacter end) -- Функция для получения позиции объекта local function getObjectPosition(obj) if obj:IsA("Model") then local primaryPart = obj.PrimaryPart or obj:FindFirstChildWhichIsA("BasePart") if primaryPart then return primaryPart.Position end elseif obj:IsA("BasePart") then return obj.Position end return nil end-- Функция для поиска ресурсов в Workspace local function findResourcesInWorkspace() if not character or not character:FindFirstChild("HumanoidRootPart") then return {} end local playerPos = character.HumanoidRootPart.Position local resources = {} -- Быстрая проверка объектов в Workspace for _, obj in ipairs(Workspace:GetChildren()) do if RESOURCES_LOOKUP[obj.Name] then local resourcePos = getObjectPosition(obj) if resourcePos then local distance = (playerPos - resourcePos).Magnitude if distance <= COLLECT_DISTANCE then table.insert(resources, { Object = obj, Name = obj.Name, Distance = distance }) end end end end -- Сортируем по расстоянию (ближайшие первыми) table.sort(resources, function(a, b) return a.Distance < b.Distance end) return resources end -- Функция сбора ресурса local function collectResource(resourceInfo) if not Pickup then return false end local success = pcall(function() Pickup:FireServer(resourceInfo.Object) return true end) return success end -- Функция обработки очереди ресурсов local function processResourceQueue() if not AUTO_COLLECT or isCollecting or #resourceQueue == 0 then return end isCollecting = true -- Обрабатываем ресурсы по одному for i = currentResourceIndex, #resourceQueue do if not AUTO_COLLECT then break end local resourceInfo = resourceQueue[i] -- Проверяем, существует ли еще объект if resourceInfo.Object and resourceInfo.Object.Parent then collectResource(resourceInfo) task.wait(COLLECT_DELAY) end currentResourceIndex = i + 1 end isCollecting = false currentResourceIndex = 1 resourceQueue = {} end -- Основной цикл сбора task.spawn(function() while task.wait(0.1) do -- Увеличил интервал проверки if AUTO_COLLECT and character and character:FindFirstChild("HumanoidRootPart") and character.Humanoid and character.Humanoid.Health > 0 then -- Находим ресурсы и добавляем в очередь local foundResources = findResourcesInWorkspace() if #foundResources > 0 then resourceQueue = foundResources processResourceQueue() end else updateCharacter() end end end) -- Управление клавишей G UserInputService.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.G then AUTO_COLLECT = not AUTO_COLLECT updateUI() -- Останавливаем текущий сбор при выключении if not AUTO_COLLECT then isCollecting = false resourceQueue = {} currentResourceIndex = 1 end end end) -- Инициализация интерфейса updateUI()