repeat task.wait() until game:IsLoaded() local Players = game:GetService("Players") local VirtualInputManager = game:GetService("VirtualInputManager") local TweenService = game:GetService("TweenService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart") local chestFolder = workspace:FindFirstChild("ChestFolder") if not chestFolder then error("Папка ChestFolder не найдена!") return end -- GUI local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui")) screenGui.Name = "ChestCollectorGui" screenGui.ResetOnSpawn = false local function createDraggableButton(name, text, position) local button = Instance.new("TextButton") button.Name = name button.Size = UDim2.new(0, 180, 0, 40) button.Position = position button.BackgroundColor3 = Color3.fromRGB(50, 50, 50) button.TextColor3 = Color3.fromRGB(255, 255, 255) button.Font = Enum.Font.GothamBold button.TextSize = 18 button.Text = text button.Parent = screenGui button.BorderSizePixel = 0 button.AutoButtonColor = true button.ZIndex = 10 local dragging, dragInput, dragStart, startPos button.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true dragStart = input.Position startPos = button.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) button.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput and dragging then local delta = input.Position - dragStart button.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) return button end local counterButton = createDraggableButton("CounterButton", "Собрано: 0", UDim2.new(0, 20, 1, -60)) local chestCounter = 0 local ignoredNames = { Chest1 = true, Chest2 = true, Chest3 = true, Chest4 = true } local collectedChests = {} local function findBasePart(object) if object:IsA("BasePart") then return object elseif object:IsA("Model") then return object:FindFirstChildWhichIsA("BasePart") end return nil end local function highlightChest(chest, color) local existing = chest:FindFirstChildOfClass("Highlight") if existing then existing.FillColor = color existing.OutlineColor = color return end local highlight = Instance.new("Highlight") highlight.FillColor = color highlight.OutlineColor = color highlight.FillTransparency = 0.5 highlight.OutlineTransparency = 0 highlight.Adornee = chest highlight.Parent = chest end local function flyToChest(targetCFrame) local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out) local goal = {CFrame = targetCFrame} local tween = TweenService:Create(humanoidRootPart, tweenInfo, goal) tween:Play() tween.Completed:Wait() end -- Основной цикл фарма task.spawn(function() while true do for _, chest in pairs(chestFolder:GetChildren()) do if ignoredNames[chest.Name] or collectedChests[chest] then continue end local basePart = findBasePart(chest) if basePart then collectedChests[chest] = true highlightChest(chest, Color3.fromRGB(0, 255, 0)) -- зелёный до сбора flyToChest(basePart.CFrame * CFrame.new(0, 3, 0)) task.wait(0.2) VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.E, false, nil) task.wait(0.1) VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.E, false, nil) chestCounter += 1 counterButton.Text = "Собрано: " .. chestCounter highlightChest(chest, Color3.fromRGB(100, 100, 100)) -- серый после сбора end end task.wait(1) end end)