local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local TeleportDelay = 1 -- Задержка между телепортами в секундах local running = false -- Изначально скрипт выключен -- Создаем GUI local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "MinichestsFarm" ScreenGui.Parent = player.PlayerGui local Frame = Instance.new("Frame") Frame.Size = UDim2.new(0, 200, 0, 80) Frame.Position = UDim2.new(0.5, -100, 0, 10) Frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40) Frame.BorderSizePixel = 0 Frame.Active = true Frame.Draggable = true -- Позволяет перемещать весь фрейм Frame.Selectable = true Frame.Parent = ScreenGui -- Верхняя панель для удобного перемещения local DragHandle = Instance.new("TextLabel") DragHandle.Name = "DragHandle" DragHandle.Text = "Minichests" DragHandle.Size = UDim2.new(1, 0, 0, 25) DragHandle.Position = UDim2.new(0, 0, 0, 0) DragHandle.BackgroundColor3 = Color3.fromRGB(60, 60, 60) DragHandle.TextColor3 = Color3.fromRGB(255, 255, 255) DragHandle.Font = Enum.Font.SourceSansBold DragHandle.TextSize = 12 DragHandle.Parent = Frame -- Кнопка закрытия local CloseButton = Instance.new("TextButton") CloseButton.Name = "CloseButton" CloseButton.Text = "X" CloseButton.Size = UDim2.new(0, 25, 0, 25) CloseButton.Position = UDim2.new(1, -25, 0, 0) CloseButton.BackgroundColor3 = Color3.fromRGB(200, 60, 60) CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255) CloseButton.Font = Enum.Font.SourceSansBold CloseButton.TextSize = 14 CloseButton.Parent = Frame -- Кнопка включения/выключения local ToggleButton = Instance.new("TextButton") ToggleButton.Size = UDim2.new(0.8, 0, 0, 30) ToggleButton.Position = UDim2.new(0.1, 0, 0.5, 0) ToggleButton.Text = "Turn on" ToggleButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70) ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) ToggleButton.Parent = Frame -- Функция для безопасного получения HumanoidRootPart local function getHumanoidRootPart() local character = player.Character if not character then character = player.CharacterAdded:Wait() end return character:WaitForChild("HumanoidRootPart") end -- Улучшенный поиск партов local function FindDesks() local desks = {} -- Основной поиск chest_2 - chest_7 for i = 2, 7 do local desk = Workspace:FindFirstChild("chest_"..i, true) if desk and desk:IsA("BasePart") then table.insert(desks, desk) end end -- Если не найдены, ищем альтернативные варианты if #desks == 0 then for _, desc in ipairs(Workspace:GetDescendants()) do if desc:IsA("BasePart") then local lowerName = desc.Name:lower() if lowerName:find("chest_") or lowerName:find("chest_") or lowerName:find("chest_") then table.insert(desks, desc) end end end end return desks end -- Основной цикл телепортации local function teleportLoop() while running do local success, err = pcall(function() local humanoidRootPart = getHumanoidRootPart() local desks = FindDesks() if #desks > 0 then local randomDesk = desks[math.random(1, #desks)] humanoidRootPart.CFrame = randomDesk.CFrame * CFrame.new(0, 3, 0) print("[TELEPORT] Moved to "..randomDesk.Name) else warn("[WARNING] No desks found! Retrying...") end end) if not success then warn("[ERROR] "..tostring(err)) end task.wait(TeleportDelay) end end -- Обработчик кнопки включения/выключения ToggleButton.MouseButton1Click:Connect(function() running = not running if running then ToggleButton.Text = "Turn off" ToggleButton.BackgroundColor3 = Color3.fromRGB(200, 60, 60) -- Красный при включении coroutine.wrap(function() local success, err = pcall(teleportLoop) if not success then warn("[CRITICAL ERROR] "..tostring(err)) end end)() else ToggleButton.Text = "Turn on" ToggleButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70) -- Серый при выключении end end) -- Обработчик кнопки закрытия CloseButton.MouseButton1Click:Connect(function() ScreenGui:Destroy() running = false -- Останавливаем цикл телепортации при закрытии end)