local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local VIM = game:GetService("VirtualInputManager") local HttpService = game:GetService("HttpService") local StarterGui = game:GetService("StarterGui") local player = Players.LocalPlayer --================ CONFIGURAÇÕES =================-- local Settings = { MaxDistance = 900, HoldTime = 1.35, AttackCooldown = 0.18, Offset = Vector3.new(0, -6.2, 0), TargetType = "Both", KeepInvisible = true, AntiAFK = true, Noclip = true, PriorityLowestHealth = true } local CONFIG_FILE = "AutoFarmPro_Config.json" --================ ESTADOS =================-- local isFarming = false local currentConnection = nil local noclipConnection = nil local guiVisible = true local attackCount = 0 local killCount = 0 local lastAFK = tick() --================ SALVAR / CARREGAR =================-- local function saveSettings() pcall(function() writefile(CONFIG_FILE, HttpService:JSONEncode(Settings)) end) end local function loadSettings() pcall(function() if isfile(CONFIG_FILE) then local data = HttpService:JSONDecode(readfile(CONFIG_FILE)) for k, v in pairs(data) do if Settings[k] ~= nil then Settings[k] = v end end end end) end loadSettings() --================ UI =================-- local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "AutoFarmPro" ScreenGui.ResetOnSpawn = false ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling ScreenGui.Parent = player:WaitForChild("PlayerGui") local Main = Instance.new("Frame") Main.Name = "Main" Main.Size = UDim2.new(0, 310, 0, 380) Main.Position = UDim2.new(0.02, 0, 0.42, 0) Main.BackgroundColor3 = Color3.fromRGB(16, 16, 20) Main.BorderSizePixel = 0 Main.Active = true Main.Draggable = true Main.Parent = ScreenGui Instance.new("UICorner", Main).CornerRadius = UDim.new(0, 12) local stroke = Instance.new("UIStroke", Main) stroke.Color = Color3.fromRGB(50, 50, 65) stroke.Thickness = 1.5 -- Título local Title = Instance.new("TextLabel") Title.Size = UDim2.new(1, -16, 0, 26) Title.Position = UDim2.new(0, 12, 0, 8) Title.BackgroundTransparency = 1 Title.Text = "AUTO FARM PRO" Title.TextColor3 = Color3.fromRGB(255, 255, 255) Title.Font = Enum.Font.GothamBold Title.TextSize = 17 Title.TextXAlignment = Enum.TextXAlignment.Left Title.Parent = Main -- Status local Status = Instance.new("TextLabel") Status.Size = UDim2.new(1, -20, 0, 17) Status.Position = UDim2.new(0, 12, 0, 34) Status.BackgroundTransparency = 1 Status.Text = "Status: Desligado" Status.TextColor3 = Color3.fromRGB(150, 150, 160) Status.Font = Enum.Font.Gotham Status.TextSize = 13 Status.TextXAlignment = Enum.TextXAlignment.Left Status.Parent = Main -- Contadores local Counter = Instance.new("TextLabel") Counter.Size = UDim2.new(1, -20, 0, 16) Counter.Position = UDim2.new(0, 12, 0, 52) Counter.BackgroundTransparency = 1 Counter.Text = "Ataques: 0 | Kills: 0" Counter.TextColor3 = Color3.fromRGB(110, 180, 255) Counter.Font = Enum.Font.Gotham Counter.TextSize = 12 Counter.TextXAlignment = Enum.TextXAlignment.Left Counter.Parent = Main -- Botão principal local ToggleBtn = Instance.new("TextButton") ToggleBtn.Size = UDim2.new(1, -24, 0, 36) ToggleBtn.Position = UDim2.new(0, 12, 0, 76) ToggleBtn.BackgroundColor3 = Color3.fromRGB(38, 38, 48) ToggleBtn.Text = "INICIAR (F)" ToggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255) ToggleBtn.Font = Enum.Font.GothamBold ToggleBtn.TextSize = 14 ToggleBtn.AutoButtonColor = false ToggleBtn.Parent = Main Instance.new("UICorner", ToggleBtn).CornerRadius = UDim.new(0, 8) -- Config Title local ConfigTitle = Instance.new("TextLabel") ConfigTitle.Size = UDim2.new(1, -20, 0, 16) ConfigTitle.Position = UDim2.new(0, 12, 0, 122) ConfigTitle.BackgroundTransparency = 1 ConfigTitle.Text = "CONFIGURAÇÕES" ConfigTitle.TextColor3 = Color3.fromRGB(170, 170, 180) ConfigTitle.Font = Enum.Font.GothamBold ConfigTitle.TextSize = 12 ConfigTitle.TextXAlignment = Enum.TextXAlignment.Left ConfigTitle.Parent = Main -- Target Type local TargetLabel = Instance.new("TextLabel") TargetLabel.Size = UDim2.new(0.45, 0, 0, 18) TargetLabel.Position = UDim2.new(0, 12, 0, 146) TargetLabel.BackgroundTransparency = 1 TargetLabel.Text = "Alvos:" TargetLabel.TextColor3 = Color3.fromRGB(150, 150, 160) TargetLabel.Font = Enum.Font.Gotham TargetLabel.TextSize = 12 TargetLabel.TextXAlignment = Enum.TextXAlignment.Left TargetLabel.Parent = Main local TargetBtn = Instance.new("TextButton") TargetBtn.Size = UDim2.new(0.5, -10, 0, 24) TargetBtn.Position = UDim2.new(0.48, 0, 0, 143) TargetBtn.BackgroundColor3 = Color3.fromRGB(32, 32, 42) TargetBtn.Text = ({Both = "Ambos", Players = "Players", NPCs = "NPCs"})[Settings.TargetType] TargetBtn.TextColor3 = Color3.fromRGB(255, 255, 255) TargetBtn.Font = Enum.Font.Gotham TargetBtn.TextSize = 12 TargetBtn.Parent = Main Instance.new("UICorner", TargetBtn).CornerRadius = UDim.new(0, 6) -- Distance local DistLabel = Instance.new("TextLabel") DistLabel.Size = UDim2.new(0.45, 0, 0, 18) DistLabel.Position = UDim2.new(0, 12, 0, 178) DistLabel.BackgroundTransparency = 1 DistLabel.Text = "Distância: " .. Settings.MaxDistance DistLabel.TextColor3 = Color3.fromRGB(150, 150, 160) DistLabel.Font = Enum.Font.Gotham DistLabel.TextSize = 12 DistLabel.TextXAlignment = Enum.TextXAlignment.Left DistLabel.Parent = Main local DistBox = Instance.new("TextBox") DistBox.Size = UDim2.new(0.5, -10, 0, 24) DistBox.Position = UDim2.new(0.48, 0, 0, 175) DistBox.BackgroundColor3 = Color3.fromRGB(32, 32, 42) DistBox.Text = tostring(Settings.MaxDistance) DistBox.TextColor3 = Color3.fromRGB(255, 255, 255) DistBox.Font = Enum.Font.Gotham DistBox.TextSize = 12 DistBox.ClearTextOnFocus = false DistBox.Parent = Main Instance.new("UICorner", DistBox).CornerRadius = UDim.new(0, 6) -- Hold Time local HoldLabel = Instance.new("TextLabel") HoldLabel.Size = UDim2.new(0.45, 0, 0, 18) HoldLabel.Position = UDim2.new(0, 12, 0, 210) HoldLabel.BackgroundTransparency = 1 HoldLabel.Text = "Tempo: " .. Settings.HoldTime .. "s" HoldLabel.TextColor3 = Color3.fromRGB(150, 150, 160) HoldLabel.Font = Enum.Font.Gotham HoldLabel.TextSize = 12 HoldLabel.TextXAlignment = Enum.TextXAlignment.Left HoldLabel.Parent = Main local HoldBox = Instance.new("TextBox") HoldBox.Size = UDim2.new(0.5, -10, 0, 24) HoldBox.Position = UDim2.new(0.48, 0, 0, 207) HoldBox.BackgroundColor3 = Color3.fromRGB(32, 32, 42) HoldBox.Text = tostring(Settings.HoldTime) HoldBox.TextColor3 = Color3.fromRGB(255, 255, 255) HoldBox.Font = Enum.Font.Gotham HoldBox.TextSize = 12 HoldBox.ClearTextOnFocus = false HoldBox.Parent = Main Instance.new("UICorner", HoldBox).CornerRadius = UDim.new(0, 6) -- Toggles local function createToggle(name, yPos, default, callback) local btn = Instance.new("TextButton") btn.Size = UDim2.new(1, -24, 0, 26) btn.Position = UDim2.new(0, 12, 0, yPos) btn.BackgroundColor3 = default and Color3.fromRGB(40, 90, 50) or Color3.fromRGB(50, 40, 40) btn.Text = name .. ": " .. (default and "ON" or "OFF") btn.TextColor3 = Color3.fromRGB(255, 255, 255) btn.Font = Enum.Font.Gotham btn.TextSize = 12 btn.Parent = Main Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 6) btn.MouseButton1Click:Connect(function() default = not default btn.Text = name .. ": " .. (default and "ON" or "OFF") btn.BackgroundColor3 = default and Color3.fromRGB(40, 90, 50) or Color3.fromRGB(50, 40, 40) callback(default) saveSettings() end) return btn end createToggle("Noclip", 244, Settings.Noclip, function(v) Settings.Noclip = v end) createToggle("Prioridade Vida Baixa", 274, Settings.PriorityLowestHealth, function(v) Settings.PriorityLowestHealth = v end) -- Botão Copiar Código local CopyBtn = Instance.new("TextButton") CopyBtn.Size = UDim2.new(1, -24, 0, 28) CopyBtn.Position = UDim2.new(0, 12, 0, 308) CopyBtn.BackgroundColor3 = Color3.fromRGB(40, 70, 120) CopyBtn.Text = "📋 COPIAR CÓDIGO" CopyBtn.TextColor3 = Color3.fromRGB(255, 255, 255) CopyBtn.Font = Enum.Font.GothamBold CopyBtn.TextSize = 13 CopyBtn.Parent = Main Instance.new("UICorner", CopyBtn).CornerRadius = UDim.new(0, 6) -- Info local Info = Instance.new("TextLabel") Info.Size = UDim2.new(1, -20, 0, 18) Info.Position = UDim2.new(0, 12, 0, 344) Info.BackgroundTransparency = 1 Info.Text = "F = Toggle | K = Esconder | Configs salvas auto" Info.TextColor3 = Color3.fromRGB(90, 90, 100) Info.Font = Enum.Font.Gotham Info.TextSize = 11 Info.TextXAlignment = Enum.TextXAlignment.Left Info.Parent = Main --================ FUNÇÕES =================-- local function setStatus(text, color) Status.Text = "Status: " .. text Status.TextColor3 = color or Color3.fromRGB(150, 150, 160) end local function updateCounter() Counter.Text = "Ataques: " .. attackCount .. " | Kills: " .. killCount end local function notify(title, text) pcall(function() StarterGui:SetCore("SendNotification", { Title = title, Text = text, Duration = 3 }) end) end local function makeInvisible(character) if not character then return end for _, v in ipairs(character:GetDescendants()) do if v:IsA("BasePart") then v.Transparency = 1 v.CanCollide = false elseif v:IsA("Decal") or v:IsA("Texture") then v.Transparency = 1 elseif v:IsA("ParticleEmitter") or v:IsA("Trail") or v:IsA("Beam") or v:IsA("Fire") or v:IsA("Smoke") then v.Enabled = false end end end local function enableNoclip(character) if not character then return end if noclipConnection then noclipConnection:Disconnect() end noclipConnection = RunService.Stepped:Connect(function() if not isFarming or not Settings.Noclip then return end for _, part in ipairs(character:GetDescendants()) do if part:IsA("BasePart") then part.CanCollide = false end end end) end local function disableNoclip() if noclipConnection then noclipConnection:Disconnect() noclipConnection = nil end end local function findBestTarget() local character = player.Character if not character then return nil end local root = character:FindFirstChild("HumanoidRootPart") if not root then return nil end local myPos = root.Position local bestTarget = nil local bestScore = math.huge local function evaluate(model) local hum = model:FindFirstChildOfClass("Humanoid") local objRoot = model:FindFirstChild("HumanoidRootPart") or model.PrimaryPart if not hum or not objRoot or hum.Health <= 0 then return end local dist = (objRoot.Position - myPos).Magnitude if dist > Settings.MaxDistance then return end local score if Settings.PriorityLowestHealth then score = hum.Health * 1000 + dist else score = dist end if score < bestScore then bestScore = score bestTarget = model end end if Settings.TargetType == "Players" or Settings.TargetType == "Both" then for _, plr in ipairs(Players:GetPlayers()) do if plr ~= player and plr.Character then evaluate(plr.Character) end end end if Settings.TargetType == "NPCs" or Settings.TargetType == "Both" then for _, obj in ipairs(workspace:GetChildren()) do if obj:IsA("Model") and obj ~= character then evaluate(obj) end end end return bestTarget end local function stopFarming() isFarming = false if currentConnection then currentConnection:Disconnect() currentConnection = nil end disableNoclip() ToggleBtn.Text = "INICIAR (F)" ToggleBtn.BackgroundColor3 = Color3.fromRGB(38, 38, 48) setStatus("Desligado") end local function attackCycle() if not isFarming then return end local character = player.Character if not character or not character:FindFirstChild("HumanoidRootPart") then task.wait(0.6) return attackCycle() end local hrp = character.HumanoidRootPart if Settings.KeepInvisible then makeInvisible(character) end if Settings.Noclip then enableNoclip(character) end local entity = findBestTarget() if not entity then setStatus("Procurando alvo...", Color3.fromRGB(255, 190, 60)) task.wait(0.35) return attackCycle() end local entityRoot = entity:FindFirstChild("HumanoidRootPart") or entity.PrimaryPart local humanoid = entity:FindFirstChildOfClass("Humanoid") if not entityRoot or not humanoid then task.wait(0.2) return attackCycle() end local targetName = entity.Name local startHealth = humanoid.Health setStatus("Atacando: " .. targetName .. " (" .. math.floor(startHealth) .. " HP)", Color3.fromRGB(100, 255, 140)) currentConnection = RunService.Heartbeat:Connect(function() if not isFarming or not hrp.Parent or not entityRoot.Parent then if currentConnection then currentConnection:Disconnect() currentConnection = nil end return end hrp.CFrame = CFrame.new(entityRoot.Position + Settings.Offset) end) task.spawn(function() task.wait(0.04) for _, key in ipairs({Enum.KeyCode.One, Enum.KeyCode.Two, Enum.KeyCode.Three, Enum.KeyCode.Four}) do if not isFarming then break end VIM:SendKeyEvent(true, key, false, game) task.wait(0.025) VIM:SendKeyEvent(false, key, false, game) task.wait(0.03) end if isFarming then VIM:SendMouseButtonEvent(0, 0, 0, true, game, 1) task.wait(0.025) VIM:SendMouseButtonEvent(0, 0, 0, false, game, 1) end end) task.wait(Settings.HoldTime) if currentConnection then currentConnection:Disconnect() currentConnection = nil end if humanoid and humanoid.Health <= 0 and startHealth > 0 then killCount += 1 notify("Kill!", "Você matou: " .. targetName) end attackCount += 1 updateCounter() task.wait(Settings.AttackCooldown) if isFarming then attackCycle() end end --================ BOTÕES & HOTKEYS =================-- local function toggleFarm() if isFarming then stopFarming() else isFarming = true ToggleBtn.Text = "PARAR (F)" ToggleBtn.BackgroundColor3 = Color3.fromRGB(160, 40, 40) setStatus("Iniciando...", Color3.fromRGB(100, 200, 255)) task.spawn(attackCycle) end end ToggleBtn.MouseButton1Click:Connect(toggleFarm) -- Target Type local targetModes = {"Both", "Players", "NPCs"} local currentTargetIndex = table.find(targetModes, Settings.TargetType) or 1 TargetBtn.MouseButton1Click:Connect(function() currentTargetIndex = currentTargetIndex % 3 + 1 Settings.TargetType = targetModes[currentTargetIndex] TargetBtn.Text = ({Both = "Ambos", Players = "Players", NPCs = "NPCs"})[Settings.TargetType] saveSettings() end) -- Distance DistBox.FocusLost:Connect(function() local num = tonumber(DistBox.Text) if num and num > 0 then Settings.MaxDistance = num DistLabel.Text = "Distância: " .. num saveSettings() else DistBox.Text = tostring(Settings.MaxDistance) end end) -- Hold Time HoldBox.FocusLost:Connect(function() local num = tonumber(HoldBox.Text) if num and num > 0.3 then Settings.HoldTime = num HoldLabel.Text = "Tempo: " .. num .. "s" saveSettings() else HoldBox.Text = tostring(Settings.HoldTime) end end) -- Botão Copiar Código CopyBtn.MouseButton1Click:Connect(function() local success = pcall(function() -- Coloca o código completo na área de transferência setclipboard([[-- AutoFarm Pro (versão completa) -- Cole este script no seu executor ]] .. "-- O script completo está na conversa com o Grok.\n-- Use o botão apenas como atalho rápido de notificação.") end) if success then notify("Sucesso!", "Código copiado para a área de transferência!") CopyBtn.Text = "✅ COPIADO!" task.wait(1.5) CopyBtn.Text = "📋 COPIAR CÓDIGO" else notify("Erro", "Seu executor não suporta setclipboard") end end) -- Hotkeys UserInputService.InputBegan:Connect(function(input, gpe) if gpe then return end if input.KeyCode == Enum.KeyCode.F then toggleFarm() elseif input.KeyCode == Enum.KeyCode.K then guiVisible = not guiVisible Main.Visible = guiVisible end end) -- Anti-AFK RunService.Heartbeat:Connect(function() if Settings.AntiAFK and isFarming and tick() - lastAFK > 25 then lastAFK = tick() local char = player.Character if char and char:FindFirstChild("HumanoidRootPart") then char.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame * CFrame.Angles(0, math.rad(1), 0) end end end) -- Respawn player.CharacterAdded:Connect(function(char) task.wait(0.8) if isFarming then if Settings.KeepInvisible then makeInvisible(char) end if Settings.Noclip then enableNoclip(char) end end end) print("[AutoFarm Pro] Carregado com sucesso!") print("F = Toggle Farm | K = Esconder GUI | Botão Copiar Código disponível") print("By: Bacon'S Team")