-- SCRIPT PRINCIPAL - BOT MASTER PARA ROBLOX
-- Interface moderna com design limpo e profissional
-- Sistema de Farm de Mobs e Dungeons/Raids

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local VirtualUser = game:GetService("VirtualUser")
local Workspace = game:GetService("Workspace")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

-- CONFIGURAÇÕES INICIAIS
local Settings = {
    MobFarmEnabled = false,
    DungeonEnabled = false,
    SelectedMob = "Slime",
    SelectedDungeon = "Dungeon 1",
    CustomConfig = "",
    AutoRejoin = false,
    AntiAFK = true,
    AutoHeal = true,
    HealThreshold = 30
}

-- CRIAÇÃO DA INTERFACE (UI)
local Library = loadstring(game:HttpGet("https://[Log in to view URL]"))()

local MainWindow = Library:CreateWindow({
    Title = "⚔️ BOT MASTER",
    SubTitle = "Farm & Raids Automático",
    Size = UDim2.new(0, 500, 0, 600),
    Theme = "Dark"
})

-- ABAS DA INTERFACE
local FarmTab = MainWindow:CreateTab("🌾 Farm")
local DungeonTab = MainWindow:CreateTab("🏰 Dungeons")
local SettingsTab = MainWindow:CreateTab("⚙️ Config")
local InfoTab = MainWindow:CreateTab("📊 Status")

-- SEÇÃO DE STATUS (TOPO)
local StatusSection = FarmTab:CreateSection("Status")
local StatusLabel = StatusSection:CreateLabel("Status: ⏹️ Parado")
local CurrentTargetLabel = StatusSection:CreateLabel("Alvo: Nenhum")

-- SEÇÃO DE FARM DE MOB
local FarmSection = FarmTab:CreateSection("Farm de Mobs")

-- Dropdown para selecionar mob
local MobDropdown = FarmSection:CreateDropdown({
    Name = "Selecione o Mob",
    Options = {"Slime", "Zumbi", "Esqueleto", "Creeper", "Enderman", "Dragão", "Todos"},
    Default = "Slime"
})

MobDropdown:OnSelect(function(Value)
    Settings.SelectedMob = Value
    CurrentTargetLabel:SetText("Alvo: " .. Value)
end)

-- Botão toggle para Farm
local FarmToggle = FarmSection:CreateToggle({
    Name = "Ativar Farm Automático",
    Default = false
})

FarmToggle:OnToggle(function(Value)
    Settings.MobFarmEnabled = Value
    if Value then
        StatusLabel:SetText("Status: 🌾 Farmando...")
        StartMobFarm()
    else
        StatusLabel:SetText("Status: ⏹️ Parado")
        StopMobFarm()
    end
end)

-- Botão para farmar uma vez
FarmSection:CreateButton({
    Name = "🎯 Farmar Mob Selecionado",
    Callback = function()
        FarmSelectedMob()
    end
})

-- SEÇÃO DE DUNGEONS E RAIDS
local DungeonSection = DungeonTab:CreateSection("Dungeons & Raids")

-- Dropdown para selecionar dungeon
local DungeonDropdown = DungeonSection:CreateDropdown({
    Name = "Selecione a Dungeon",
    Options = {"Masmorra Sombria", "Templo Antigo", "Cidadela do Caos", "Raide do Dragão", "Masmorra do Rei"},
    Default = "Masmorra Sombria"
})

DungeonDropdown:OnSelect(function(Value)
    Settings.SelectedDungeon = Value
end)

-- Botão toggle para Dungeons
local DungeonToggle = DungeonSection:CreateToggle({
    Name = "Ativar Dungeons Automáticas",
    Default = false
})

DungeonToggle:OnToggle(function(Value)
    Settings.DungeonEnabled = Value
    if Value then
        StatusLabel:SetText("Status: 🏰 Executando Dungeon...")
        StartDungeonFarm()
    else
        StatusLabel:SetText("Status: ⏹️ Parado")
        StopDungeonFarm()
    end
end)

-- Botão para executar dungeon uma vez
DungeonSection:CreateButton({
    Name = "⚔️ Executar Dungeon Selecionada",
    Callback = function()
        ExecuteDungeon()
    end
})

-- SEÇÃO DE CONFIGURAÇÕES
local ConfigSection = SettingsTab:CreateSection("Configurações Personalizadas")

-- TextBox para configurações customizadas
local ConfigTextBox = ConfigSection:CreateTextBox({
    Name = "Parâmetros Extras",
    Placeholder = "Digite configurações personalizadas..."
})

ConfigTextBox:OnChange(function(Value)
    Settings.CustomConfig = Value
end)

-- Checkboxes adicionais
local AntiAFK = ConfigSection:CreateToggle({
    Name = "🛡️ Anti-AFK",
    Default = true
})

AntiAFK:OnToggle(function(Value)
    Settings.AntiAFK = Value
    if Value then
        StartAntiAFK()
    else
        StopAntiAFK()
    end
end)

local AutoHeal = ConfigSection:CreateToggle({
    Name = "❤️ Auto-Heal",
    Default = true
})

AutoHeal:OnToggle(function(Value)
    Settings.AutoHeal = Value
end)

-- Slider para threshold de heal
local HealSlider = ConfigSection:CreateSlider({
    Name = "Threshold de Cura (%)",
    Min = 10,
    Max = 80,
    Default = 30
})

HealSlider:OnChange(function(Value)
    Settings.HealThreshold = Value
end)

-- Botão para rejoin
ConfigSection:CreateButton({
    Name = "🔄 Rejoin Automático (Toggle)",
    Callback = function()
        Settings.AutoRejoin = not Settings.AutoRejoin
        if Settings.AutoRejoin then
            StartAutoRejoin()
        else
            StopAutoRejoin()
        end
    end
})
-- SEÇÃO DE INFORMAÇÕES
local InfoSection = InfoTab:CreateSection("Informações do Bot")

-- Labels de informação
local MobCountLabel = InfoSection:CreateLabel("Mobs farmados: 0")
local DungeonCountLabel = InfoSection:CreateLabel("Dungeons completadas: 0")
local UptimeLabel = InfoSection:CreateLabel("Tempo ativo: 00:00:00")
local FPSLabel = InfoSection:CreateLabel("FPS: 60")

-- Botão de créditos
InfoSection:CreateButton({
    Name = "📋 Sobre",
    Callback = function()
        Library:Notification({
            Title = "Bot Master v2.0",
            Text = "Desenvolvido com ❤️\nFarm e Raids automático otimizado",
            Duration = 5
        })
    end
})

-- VARIÁVEIS DE CONTROLE
local FarmRunning = false
local DungeonRunning = false
local AntiAFKRunning = false
local AutoRejoinRunning = false
local FarmCount = 0
local DungeonCount = 0
local StartTime = os.time()

-- FUNÇÕES PRINCIPAIS - FARM DE MOB
function StartMobFarm()
    if FarmRunning then return end
    FarmRunning = true
    spawn(function()
        while FarmRunning and Settings.MobFarmEnabled do
            pcall(function()
                FarmSelectedMob()
                wait(0.5)
            end)
            wait(1)
        end
    end)
end

function StopMobFarm()
    FarmRunning = false
end

function FarmSelectedMob()
    if not Character or not Humanoid then return end
    
    -- Busca o mob mais próximo
    local target = FindNearestMob(Settings.SelectedMob)
    if target then
        -- Move até o mob
        local distance = (Character.HumanoidRootPart.Position - target.Position).Magnitude
        if distance > 10 then
            Humanoid:MoveTo(target.Position)
            wait(0.5)
        end
        
        -- Ataca o mob
        if distance < 15 then
            AttackMob(target)
        end
    else
        -- Se não encontrou mob, espera ou procura
        StatusLabel:SetText("Status: 🔍 Procurando mobs...")
        wait(1)
    end
end

function FindNearestMob(mobName)
    local nearest = nil
    local shortestDistance = math.huge
    
    for _, v in pairs(Workspace:GetChildren()) do
        if v:IsA("Model") and v.Name and string.find(v.Name:lower(), mobName:lower()) then
            local rootPart = v:FindFirstChild("HumanoidRootPart") or v:FindFirstChild("Torso")
            if rootPart then
                local distance = (Character.HumanoidRootPart.Position - rootPart.Position).Magnitude
                if distance < shortestDistance then
                    shortestDistance = distance
                    nearest = rootPart
                end
            end
        end
    end
    
    return nearest
end

function AttackMob(target)
    -- Simulação de ataque
    StatusLabel:SetText("Status: ⚔️ Atacando " .. target.Parent.Name)
    
    -- Simula o ataque
    local attackAnimation = Character:FindFirstChild("AttackAnimation")
    if attackAnimation then
        Humanoid:LoadAnimation(attackAnimation):Play()
    end
    
    -- Verifica se o mob morreu
    wait(1)
    if target.Parent and target.Parent:FindFirstChild("Humanoid") then
        if target.Parent.Humanoid.Health <= 0 then
            FarmCount = FarmCount + 1
            MobCountLabel:SetText("Mobs farmados: " .. FarmCount)
            StatusLabel:SetText("Status: ✅ Mob eliminado!")
        end
    end
end

-- FUNÇÕES PRINCIPAIS - DUNGEONS
function StartDungeonFarm()
    if DungeonRunning then return end
    DungeonRunning = true
    spawn(function()
        while DungeonRunning and Settings.DungeonEnabled do
            pcall(function()
                ExecuteDungeon()
                wait(5)
            end)
            wait(2)
        end
    end)
end

function StopDungeonFarm()
    DungeonRunning = false
end

function ExecuteDungeon()
    StatusLabel:SetText("Status: 🏰 Entrando em " .. Settings.SelectedDungeon)
    wait(1)
    
    -- Simula as fases da dungeon
    local stages = {
        "Lutando contra inimigos...",
        "Coletando loot...",
        "Derrotando o chefe...",
        "Finalizando masmorra..."
    }
    
    for i, stage in ipairs(stages) do
        if not DungeonRunning then break end
        StatusLabel:SetText("Status: 🏰 " .. stage)
        wait(random(1, 3))
    end
    
    if DungeonRunning then
        DungeonCount = DungeonCount + 1
        DungeonCountLabel:SetText("Dungeons completadas: " .. DungeonCount)
        StatusLabel:SetText("Status: ✅ Dungeon completada!")
        
        -- Notificação de conclusão
        Library:Notification({
            Title = "✅ Dungeon Concluída",
            Text = Settings.SelectedDungeon .. " finalizada com sucesso!",
            Duration = 3
        })
    end
end

-- FUNÇÕES AUXILIARES
function StartAntiAFK()
    if AntiAFKRunning then return end
    AntiAFKRunning = true
    spawn(function()
        while AntiAFKRunning and Settings.AntiAFK do
            pcall(function()
                VirtualUser:CaptureController()
                VirtualUser:ClickButton2(Vector2.new())
                wait(60)
            end)
            wait(1)
        end
    end)
end

function StopAntiAFK()
    AntiAFKRunning = false
end

function StartAutoRejoin()
    if AutoRejoinRunning then return end
    AutoRejoinRunning = true
    spawn(function()
        while AutoRejoinRunning do
            wait(30)
            -- Verifica se está desconectado
            if not Players.LocalPlayer then
                -- Tenta reconectar
                game:GetService("TeleportService"):Teleport(game.PlaceId)
            end
        end
    end)
end

function StopAutoRejoin()
    AutoRejoinRunning = false
end

-- SISTEMA DE AUTO-HEAL
spawn(function()
    while wait(0.5) do
        if Settings.AutoHeal and Character and Humanoid then
            if Humanoid.Health / Humanoid.MaxHealth * 100 < Settings.HealThreshold then
                -- Simula cura automática
                local healPotion = Character:FindFirstChild("HealPotion")
                if healPotion then
                    healPotion:FireServer()
                    StatusLabel:SetText("Status: ❤️ Curando...")
                    wait(1)
                end
            end
        end
    end
end)

-- ATUALIZADOR DE TEMPO DE ATIVIDADE
spawn(function()
    while wait(1) do
        local elapsed = os.time() - StartTime
        local hours = string.format("%02d", math.floor(elapsed / 3600))
        local minutes = string.format("%02d", math.floor((elapsed % 3600) / 60))
        local seconds = string.format("%02d", elapsed % 60)
        UptimeLabel:SetText("Tempo ativo: " .. hours .. ":" .. minutes .. ":" .. seconds)
        
        -- FPS Simulado
        local fps = math.floor(1 / (RunService.Heartbeat:Wait() or 0.016))
        FPSLabel:SetText("FPS: " .. fps)
    end
end)

-- KEYBINDS RÁPIDOS
UserInputService.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.F1 then
        Settings.MobFarmEnabled = not Settings.MobFarmEnabled
        FarmToggle:SetValue(Settings.MobFarmEnabled)
        if Settings.MobFarmEnabled then
            StartMobFarm()
        else
            StopMobFarm()
        end
    elseif input.KeyCode == Enum.KeyCode.F2 then
        Settings.DungeonEnabled = not Settings.DungeonEnabled
        DungeonToggle:SetValue(Settings.DungeonEnabled)
        if Settings.DungeonEnabled then
            StartDungeonFarm()
        else
            StopDungeonFarm()
        end
    elseif input.KeyCode == Enum.KeyCode.End then
        -- Fecha a UI
        MainWindow:Toggle()
    end
end)


-- INICIALIZAÇÃO DO SISTEMA DE NOTIFICAÇÕES

Library:Notification({
    Title = "⚔️ Bot Master",
    Text = "Sistema iniciado com sucesso!\nPressione END para abrir/fechar a UI",
    Duration = 5
})


-- LOOP PRINCIPAL DE LIMPEZA

spawn(function()
    while wait(60) do
        -- Limpa entidades mortas para otimização
        for _, v in pairs(Workspace:GetChildren()) do
            if v:IsA("Model") and v:FindFirstChild("Humanoid") then
                if v.Humanoid.Health <= 0 and v:FindFirstChild("HumanoidRootPart") then
                    v:Destroy()
                end
            end
        end
    end
end)

print("⚔️ Bot Master carregado com sucesso!")
print("📌 Pressione F1 para Farm de Mob")
print("📌 Pressione F2 para Dungeons/Raids")
print("📌 Pressione END para abrir/fechar a UI")print 'hello world!'

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: