--[[ Created by Ayb1 scriptblox.com ]] local Players = game:GetService("Players") local TweenService = game:GetService("TweenService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") -- Priority: higher number = better chest local PRIORITY = { ["Legendary"] = 4, ["Epic"] = 3, ["Rare"] = 2, ["Common"] = 1, } local isRunning = false -- ===================== -- CREATE UI -- ===================== local screenGui = Instance.new("ScreenGui") screenGui.Name = "ChestBotUI" screenGui.ResetOnSpawn = false screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling screenGui.Parent = playerGui local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 180, 0, 70) frame.Position = UDim2.new(0.5, -90, 0.82, 0) frame.BackgroundColor3 = Color3.fromRGB(10, 10, 18) frame.BackgroundTransparency = 0.1 frame.BorderSizePixel = 0 frame.Active = true frame.Draggable = true frame.Parent = screenGui Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 18) local stroke = Instance.new("UIStroke") stroke.Color = Color3.fromRGB(80, 80, 255) stroke.Thickness = 1.5 stroke.Transparency = 0.3 stroke.Parent = frame local statusLabel = Instance.new("TextLabel") statusLabel.Size = UDim2.new(1, 0, 0, 22) statusLabel.Position = UDim2.new(0, 0, 0, 6) statusLabel.BackgroundTransparency = 1 statusLabel.Text = "🗝️ CHEST BOT" statusLabel.TextColor3 = Color3.fromRGB(180, 180, 255) statusLabel.TextSize = 13 statusLabel.Font = Enum.Font.GothamBold statusLabel.Parent = frame local btn = Instance.new("TextButton") btn.Size = UDim2.new(0, 140, 0, 32) btn.Position = UDim2.new(0.5, -70, 1, -40) btn.BackgroundColor3 = Color3.fromRGB(40, 40, 180) btn.Text = "▶ START" btn.TextColor3 = Color3.fromRGB(255, 255, 255) btn.TextSize = 13 btn.Font = Enum.Font.GothamBold btn.BorderSizePixel = 0 btn.Parent = frame Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 12) -- ===================== -- LOGIC -- ===================== local function findBestChest() local chestsFolder = workspace:FindFirstChild("Main") and workspace.Main:FindFirstChild("ChestsInWorld") if not chestsFolder then warn("workspace.Main.ChestsInWorld not found") return nil end local bestChest = nil local bestPriority = 0 for _, chest in ipairs(chestsFolder:GetChildren()) do local p = PRIORITY[chest.Name] if p and p > bestPriority then bestPriority = p bestChest = chest end end return bestChest end local function getPrompt(chest) for _, obj in ipairs(chest:GetDescendants()) do if obj:IsA("ProximityPrompt") then return obj end end return nil end local function getPos(chest) if chest:IsA("BasePart") then return chest.Position end if chest.PrimaryPart then return chest.PrimaryPart.Position end for _, p in ipairs(chest:GetDescendants()) do if p:IsA("BasePart") then return p.Position end end return nil end local function runLoop() if not isRunning then return end local character = player.Character if not character then task.wait(1) runLoop() return end local hrp = character:FindFirstChild("HumanoidRootPart") if not hrp then task.wait(1) runLoop() return end local chest = findBestChest() if not chest then statusLabel.Text = "❌ No chests" task.wait(2) runLoop() return end local pos = getPos(chest) if not pos then statusLabel.Text = "⚠️ No position" task.wait(2) runLoop() return end -- Status color by rarity local colors = { Legendary = Color3.fromRGB(255, 170, 0), Epic = Color3.fromRGB(170, 0, 255), Rare = Color3.fromRGB(0, 120, 255), Common = Color3.fromRGB(180, 180, 180), } statusLabel.TextColor3 = colors[chest.Name] or Color3.fromRGB(180, 180, 255) statusLabel.Text = "✨ " .. chest.Name -- Teleport hrp.CFrame = CFrame.new(pos + Vector3.new(0, 3, 3)) task.wait(0.4) -- Trigger ProximityPrompt local prompt = getPrompt(chest) if prompt then fireproximityprompt(prompt) end task.wait(1.5) runLoop() end local function setRunning(state) isRunning = state if state then TweenService:Create(btn, TweenInfo.new(0.25), { BackgroundColor3 = Color3.fromRGB(200, 40, 40) }):Play() TweenService:Create(stroke, TweenInfo.new(0.25), { Color = Color3.fromRGB(255, 80, 80) }):Play() btn.Text = "⏹ STOP" statusLabel.Text = "🔍 Searching..." statusLabel.TextColor3 = Color3.fromRGB(180, 180, 255) task.spawn(runLoop) else TweenService:Create(btn, TweenInfo.new(0.25), { BackgroundColor3 = Color3.fromRGB(40, 40, 180) }):Play() TweenService:Create(stroke, TweenInfo.new(0.25), { Color = Color3.fromRGB(80, 80, 255) }):Play() btn.Text = "▶ START" statusLabel.Text = "🗝️ CHEST BOT" statusLabel.TextColor3 = Color3.fromRGB(180, 180, 255) end end btn.MouseButton1Click:Connect(function() setRunning(not isRunning) end) print("✅ ChestBot loaded — workspace.Main.ChestsInWorld")