DIKOKOP
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local VIM = game:GetService("VirtualInputManager")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")
local State = {
farming = false,
selectedMobs = {},
selectedWeapon = nil,
farmLoop = nil,
}
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "AutoFarmGUI"
ScreenGui.ResetOnSpawn = false
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.Parent = player.PlayerGui
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 380, 0, 550)
MainFrame.Position = UDim2.new(0.5, -190, 0.5, -275)
MainFrame.BackgroundColor3 = Color3.fromRGB(12, 12, 18)
MainFrame.BorderSizePixel = 0
MainFrame.Active = true
MainFrame.Draggable = true
MainFrame.ClipsDescendants = true
MainFrame.Parent = ScreenGui
Instance.new("UICorner", MainFrame).CornerRadius = UDim.new(0, 12)
-- Border (inside MainFrame, akan ikut geser & terpotong ClipsDescendants)
local BorderFrame = Instance.new("Frame")
BorderFrame.Size = UDim2.new(1, 4, 1, 4)
BorderFrame.Position = UDim2.new(0, -2, 0, -2)
BorderFrame.BackgroundColor3 = Color3.fromRGB(255, 165, 0)
BorderFrame.BorderSizePixel = 0
BorderFrame.ZIndex = 0
BorderFrame.Parent = MainFrame
Instance.new("UICorner", BorderFrame).CornerRadius = UDim.new(0, 14)
local TitleBar = Instance.new("Frame")
TitleBar.Size = UDim2.new(1, 0, 0, 50)
TitleBar.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
TitleBar.BorderSizePixel = 0
TitleBar.ZIndex = 2
TitleBar.Parent = MainFrame
Instance.new("UICorner", TitleBar).CornerRadius = UDim.new(0, 12)
local TitleFix = Instance.new("Frame")
TitleFix.Size = UDim2.new(1, 0, 0, 12)
TitleFix.Position = UDim2.new(0, 0, 1, -12)
TitleFix.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
TitleFix.BorderSizePixel = 0
TitleFix.ZIndex = 2
TitleFix.Parent = TitleBar
local TitleLabel = Instance.new("TextLabel")
TitleLabel.Size = UDim2.new(1, -90, 1, 0)
TitleLabel.Position = UDim2.new(0, 15, 0, 0)
TitleLabel.BackgroundTransparency = 1
TitleLabel.Text = "AUTO FARM - Blox Fruits"
TitleLabel.TextColor3 = Color3.fromRGB(255, 165, 0)
TitleLabel.TextSize = 16
TitleLabel.Font = Enum.Font.GothamBold
TitleLabel.TextXAlignment = Enum.TextXAlignment.Left
TitleLabel.ZIndex = 2
TitleLabel.Parent = TitleBar
local CloseBtn = Instance.new("TextButton")
CloseBtn.Size = UDim2.new(0, 30, 0, 30)
CloseBtn.Position = UDim2.new(1, -40, 0.5, -15)
CloseBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
CloseBtn.Text = "X"
CloseBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseBtn.TextSize = 14
CloseBtn.Font = Enum.Font.GothamBold
CloseBtn.BorderSizePixel = 0
CloseBtn.ZIndex = 2
CloseBtn.Parent = TitleBar
Instance.new("UICorner", CloseBtn).CornerRadius = UDim.new(0, 6)
CloseBtn.MouseButton1Click:Connect(function() ScreenGui😃estroy() end)
local minimized = false
local MinBtn = Instance.new("TextButton")
MinBtn.Size = UDim2.new(0, 30, 0, 30)
MinBtn.Position = UDim2.new(1, -76, 0.5, -15)
MinBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 80)
MinBtn.Text = "-"
MinBtn.TextColor3 = Color3.fromRGB(255, 165, 0)
MinBtn.TextSize = 18
MinBtn.Font = Enum.Font.GothamBold
MinBtn.BorderSizePixel = 0
MinBtn.ZIndex = 2
MinBtn.Parent = TitleBar
Instance.new("UICorner", MinBtn).CornerRadius = UDim.new(0, 6)
local ContentFrame = Instance.new("Frame")
ContentFrame.Size = UDim2.new(1, -20, 1, -60)
ContentFrame.Position = UDim2.new(0, 10, 0, 55)
ContentFrame.BackgroundTransparency = 1
ContentFrame.ZIndex = 2
ContentFrame.Parent = MainFrame
MinBtn.MouseButton1Click:Connect(function()
minimized = not minimized
if minimized then
MainFrame.Size = UDim2.new(0, 380, 0, 50)
MinBtn.Text = "+"
else
MainFrame.Size = UDim2.new(0, 380, 0, 550)
MinBtn.Text = "-"
end
end)
local function makeLabel(parent, text, yPos)
local lbl = Instance.new("TextLabel")
lbl.Size = UDim2.new(1, 0, 0, 20)
lbl.Position = UDim2.new(0, 0, 0, yPos)
lbl.BackgroundTransparency = 1
lbl.Text = text
lbl.TextColor3 = Color3.fromRGB(255, 165, 0)
lbl.TextSize = 13
lbl.Font = Enum.Font.GothamBold
lbl.TextXAlignment = Enum.TextXAlignment.Left
lbl.ZIndex = 2
lbl.Parent = parent
return lbl
end
makeLabel(ContentFrame, "MOB TARGET", 0)
local MobScroll = Instance.new("ScrollingFrame")
MobScroll.Size = UDim2.new(1, 0, 0, 195)
MobScroll.Position = UDim2.new(0, 0, 0, 22)
MobScroll.BackgroundColor3 = Color3.fromRGB(18, 18, 28)
MobScroll.BorderSizePixel = 0
MobScroll.ScrollBarThickness = 4
MobScroll.ScrollBarImageColor3 = Color3.fromRGB(255, 165, 0)
MobScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
MobScroll.ZIndex = 2
MobScroll.Parent = ContentFrame
Instance.new("UICorner", MobScroll).CornerRadius = UDim.new(0, 8)
local MobListLayout = Instance.new("UIListLayout")
MobListLayout.Padding = UDim.new(0, 4)
MobListLayout.Parent = MobScroll
local MobPad = Instance.new("UIPadding")
MobPad.PaddingTop = UDim.new(0, 6)
MobPad.PaddingLeft = UDim.new(0, 6)
MobPad.PaddingRight = UDim.new(0, 6)
MobPad.Parent = MobScroll
local SelectAllBtn = Instance.new("TextButton")
SelectAllBtn.Size = UDim2.new(0.48, 0, 0, 22)
SelectAllBtn.Position = UDim2.new(0, 0, 0, 220)
SelectAllBtn.BackgroundColor3 = Color3.fromRGB(30, 90, 30)
SelectAllBtn.Text = "Pilih Semua"
SelectAllBtn.TextColor3 = Color3.fromRGB(180, 255, 180)
SelectAllBtn.TextSize = 11
SelectAllBtn.Font = Enum.Font.GothamBold
SelectAllBtn.BorderSizePixel = 0
SelectAllBtn.ZIndex = 2
SelectAllBtn.Parent = ContentFrame
Instance.new("UICorner", SelectAllBtn).CornerRadius = UDim.new(0, 6)
local DeselectAllBtn = Instance.new("TextButton")
DeselectAllBtn.Size = UDim2.new(0.48, 0, 0, 22)
DeselectAllBtn.Position = UDim2.new(0.52, 0, 0, 220)
DeselectAllBtn.BackgroundColor3 = Color3.fromRGB(90, 30, 30)
DeselectAllBtn.Text = "Hapus Semua"
DeselectAllBtn.TextColor3 = Color3.fromRGB(255, 180, 180)
DeselectAllBtn.TextSize = 11
DeselectAllBtn.Font = Enum.Font.GothamBold
DeselectAllBtn.BorderSizePixel = 0
DeselectAllBtn.ZIndex = 2
DeselectAllBtn.Parent = ContentFrame
Instance.new("UICorner", DeselectAllBtn).CornerRadius = UDim.new(0, 6)
makeLabel(ContentFrame, "PILIH SENJATA", 252)
local WeaponScroll = Instance.new("ScrollingFrame")
WeaponScroll.Size = UDim2.new(1, 0, 0, 80)
WeaponScroll.Position = UDim2.new(0, 0, 0, 274)
WeaponScroll.BackgroundColor3 = Color3.fromRGB(18, 18, 28)
WeaponScroll.BorderSizePixel = 0
WeaponScroll.ScrollBarThickness = 4
WeaponScroll.ScrollBarImageColor3 = Color3.fromRGB(255, 165, 0)
WeaponScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
WeaponScroll.ZIndex = 2
WeaponScroll.Parent = ContentFrame
Instance.new("UICorner", WeaponScroll).CornerRadius = UDim.new(0, 8)
local WeaponListLayout = Instance.new("UIListLayout")
WeaponListLayout.Padding = UDim.new(0, 4)
WeaponListLayout.Parent = WeaponScroll
local WeaponPad = Instance.new("UIPadding")
WeaponPad.PaddingTop = UDim.new(0, 6)
WeaponPad.PaddingLeft = UDim.new(0, 6)
WeaponPad.PaddingRight = UDim.new(0, 6)
WeaponPad.Parent = WeaponScroll
local RefreshBtn = Instance.new("TextButton")
RefreshBtn.Size = UDim2.new(1, 0, 0, 22)
RefreshBtn.Position = UDim2.new(0, 0, 0, 358)
RefreshBtn.BackgroundColor3 = Color3.fromRGB(25, 25, 60)
RefreshBtn.Text = "Refresh Senjata & Mob List"
RefreshBtn.TextColor3 = Color3.fromRGB(150, 150, 255)
RefreshBtn.TextSize = 11
RefreshBtn.Font = Enum.Font.Gotham
RefreshBtn.BorderSizePixel = 0
RefreshBtn.ZIndex = 2
RefreshBtn.Parent = ContentFrame
Instance.new("UICorner", RefreshBtn).CornerRadius = UDim.new(0, 6)
local StatusLabel = Instance.new("TextLabel")
StatusLabel.Size = UDim2.new(1, 0, 0, 30)
StatusLabel.Position = UDim2.new(0, 0, 0, 386)
StatusLabel.BackgroundColor3 = Color3.fromRGB(18, 18, 28)
StatusLabel.BorderSizePixel = 0
StatusLabel.Text = "Status: Idle"
StatusLabel.TextColor3 = Color3.fromRGB(160, 160, 200)
StatusLabel.TextSize = 12
StatusLabel.Font = Enum.Font.Gotham
StatusLabel.ZIndex = 2
StatusLabel.Parent = ContentFrame
Instance.new("UICorner", StatusLabel).CornerRadius = UDim.new(0, 8)
local TargetLabel = Instance.new("TextLabel")
TargetLabel.Size = UDim2.new(1, 0, 0, 30)
TargetLabel.Position = UDim2.new(0, 0, 0, 420)
TargetLabel.BackgroundColor3 = Color3.fromRGB(18, 18, 28)
TargetLabel.BorderSizePixel = 0
TargetLabel.Text = "Target: -"
TargetLabel.TextColor3 = Color3.fromRGB(160, 160, 200)
TargetLabel.TextSize = 12
TargetLabel.Font = Enum.Font.Gotham
TargetLabel.ZIndex = 2
TargetLabel.Parent = ContentFrame
Instance.new("UICorner", TargetLabel).CornerRadius = UDim.new(0, 8)
local StartBtn = Instance.new("TextButton")
StartBtn.Size = UDim2.new(1, 0, 0, 44)
StartBtn.Position = UDim2.new(0, 0, 0, 458)
StartBtn.BackgroundColor3 = Color3.fromRGB(255, 140, 0)
StartBtn.Text = "START FARMING"
StartBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
StartBtn.TextSize = 16
StartBtn.Font = Enum.Font.GothamBold
StartBtn.BorderSizePixel = 0
StartBtn.ZIndex = 2
StartBtn.Parent = ContentFrame
Instance.new("UICorner", StartBtn).CornerRadius = UDim.new(0, 10)
-- MOB & WEAPON BUILDERS
local mobButtons = {}
local weaponButtons = {}
local function getMobNames()
local names = {}
local seen = {}
for _, mob in pairs(workspace.Alive:GetChildren()) do
local hum = mob:FindFirstChild("Humanoid")
local hrp = mob:FindFirstChild("HumanoidRootPart")
if hum and hrp and not seen[mob.Name] then
seen[mob.Name] = true
table.insert(names, mob.Name)
end
end
table.sort(names, function(a, b)
local lvA = tonumber(a:match("Lv(%d+)")) or 0
local lvB = tonumber(b:match("Lv(%d+)")) or 0
if lvA == lvB then return a < b end
return lvA < lvB
end)
return names
end
local function buildMobButtons()
for _, v in pairs(MobScroll:GetChildren()) do
if v:IsA("TextButton") then v😃estroy() end
end
mobButtons = {}
for _, name in ipairs(getMobNames()) do
local btn = Instance.new("TextButton")
btn.Size = UDim2.new(1, -8, 0, 28)
btn.BackgroundColor3 = Color3.fromRGB(25, 25, 40)
btn.Text = " [ ] " .. name
btn.TextColor3 = Color3.fromRGB(200, 200, 220)
btn.TextSize = 12
btn.Font = Enum.Font.Gotham
btn.TextXAlignment = Enum.TextXAlignment.Left
btn.BorderSizePixel = 0
btn.ZIndex = 2
btn.Parent = MobScroll
Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 6)
local selected = false
local function setSelected(v2)
selected = v2
if v2 then
State.selectedMobs[name] = true
btn.BackgroundColor3 = Color3.fromRGB(40, 100, 40)
btn.Text = " [v] " .. name
btn.TextColor3 = Color3.fromRGB(150, 255, 150)
else
State.selectedMobs[name] = nil
btn.BackgroundColor3 = Color3.fromRGB(25, 25, 40)
btn.Text = " [ ] " .. name
btn.TextColor3 = Color3.fromRGB(200, 200, 220)
end
end
btn.MouseButton1Click:Connect(function() setSelected(not selected) end)
mobButtons[name] = {btn = btn, setSelected = setSelected}
end
MobScroll.CanvasSize = UDim2.new(0, 0, 0, MobListLayout.AbsoluteContentSize.Y + 12)
end
local function buildWeaponButtons()
for _, v in pairs(WeaponScroll:GetChildren()) do
if v:IsA("TextButton") then v😃estroy() end
end
weaponButtons = {}
local tools = {}
local seen = {}
for _, tool in pairs(player.Backpack:GetChildren()) do
if tool:IsA("Tool") and not seen[tool.Name] then
seen[tool.Name] = true
table.insert(tools, tool.Name)
end
end
for _, tool in pairs(character:GetChildren()) do
if tool:IsA("Tool") and not seen[tool.Name] then
seen[tool.Name] = true
table.insert(tools, tool.Name)
end
end
if #tools == 0 then tools = {"Melee", "Krizma"} end
for _, name in ipairs(tools) do
local btn = Instance.new("TextButton")
btn.Size = UDim2.new(1, -8, 0, 28)
btn.BackgroundColor3 = Color3.fromRGB(25, 25, 40)
btn.Text = " [ ] " .. name
btn.TextColor3 = Color3.fromRGB(200, 200, 220)
btn.TextSize = 12
btn.Font = Enum.Font.Gotham
btn.TextXAlignment = Enum.TextXAlignment.Left
btn.BorderSizePixel = 0
btn.ZIndex = 2
btn.Parent = WeaponScroll
Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 6)
btn.MouseButton1Click:Connect(function()
for wName, wData in pairs(weaponButtons) do
wData.btn.BackgroundColor3 = Color3.fromRGB(25, 25, 40)
wData.btn.Text = " [ ] " .. wName
wData.btn.TextColor3 = Color3.fromRGB(200, 200, 220)
end
State.selectedWeapon = name
btn.BackgroundColor3 = Color3.fromRGB(80, 50, 10)
btn.Text = " [v] " .. name
btn.TextColor3 = Color3.fromRGB(255, 200, 80)
end)
weaponButtons[name] = {btn = btn}
end
WeaponScroll.CanvasSize = UDim2.new(0, 0, 0, WeaponListLayout.AbsoluteContentSize.Y + 12)
end
SelectAllBtn.MouseButton1Click:Connect(function()
for _, data in pairs(mobButtons) do data.setSelected(true) end
end)
DeselectAllBtn.MouseButton1Click:Connect(function()
for _, data in pairs(mobButtons) do data.setSelected(false) end
end)
RefreshBtn.MouseButton1Click:Connect(function()
character = player.Character or character
buildMobButtons()
buildWeaponButtons()
StatusLabel.Text = "List di-refresh!"
StatusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
end)
local function attackMob()
VIM:SendMouseButtonEvent(0, 0, 0, true, game, 1)
task.wait(0.08)
VIM:SendMouseButtonEvent(0, 0, 0, false, game, 1)
end
local function equipWeapon(weaponName)
if not weaponName then return end
local tool = player.Backpack:FindFirstChild(weaponName)
if tool then
humanoid:EquipTool(tool)
task.wait(0.3)
end
end
local function getNextTarget()
local closest = nil
local closestDist = math.huge
local myPos = humanoidRootPart.Position
for _, mob in pairs(workspace.Alive:GetChildren()) do
local hum = mob:FindFirstChild("Humanoid")
local hrp = mob:FindFirstChild("HumanoidRootPart")
if hum and hrp and hum.Health > 0 and State.selectedMobs[mob.Name] then
local dist = (hrp.Position - myPos).Magnitude
if dist < closestDist then
closestDist = dist
closest = mob
end
end
end
return closest
end
local function autoSpawn()
StatusLabel.Text = "Mati! Menunggu Spawn..."
StatusLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
local attempts = 0
while attempts < 60 do
-- Cari spawn button di semua GUI kecuali punya kita
local spawnBtn = nil
for _, gui in pairs(player.PlayerGui:GetChildren()) do
if gui ~= ScreenGui then
for _, v in pairs(gui:GetDescendants()) do
if (v:IsA("TextButton") or v:IsA("ImageButton")) and v.Visible then
local txt = string.lower(v.Text or "")
if txt == "spawn" or txt == "respawn" then
spawnBtn = v
break
end
end
end
end
if spawnBtn then break end
end
if spawnBtn then
task.wait(0.3)
local pos = spawnBtn.AbsolutePosition
local size = spawnBtn.AbsoluteSize
local cx = math.floor(pos.X + size.X / 2)
local cy = math.floor(pos.Y + size.Y / 2)
-- Geser mouse ke tombol lalu klik
VIM:SendMouseMoveEvent(cx, cy, game)
task.wait(0.1)
VIM:SendMouseButtonEvent(cx, cy, 0, true, game, 1)
task.wait(0.1)
VIM:SendMouseButtonEvent(cx, cy, 0, false, game, 1)
StatusLabel.Text = "Auto Spawn!"
StatusLabel.TextColor3 = Color3.fromRGB(100, 200, 255)
-- Tunggu karakter respawn
task.wait(1)
player.CharacterAdded:Wait()
task.wait(1)
return true
end
attempts = attempts + 1
task.wait(0.2)
end
return false
end
local function stopFarming()
State.farming = false
if State.farmLoop then
task.cancel(State.farmLoop)
State.farmLoop = nil
end
StatusLabel.Text = "Status: Idle"
StatusLabel.TextColor3 = Color3.fromRGB(160, 160, 200)
TargetLabel.Text = "Target: -"
StartBtn.Text = "START FARMING"
StartBtn.BackgroundColor3 = Color3.fromRGB(255, 140, 0)
end
local function startFarming()
local mobCount = 0
for _ in pairs(State.selectedMobs) do mobCount = mobCount + 1 end
if mobCount == 0 then
StatusLabel.Text = "Pilih minimal 1 mob!"
StatusLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
return
end
if not State.selectedWeapon then
StatusLabel.Text = "Pilih senjata dulu!"
StatusLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
return
end
State.farming = true
StartBtn.Text = "STOP FARMING"
StartBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
State.farmLoop = task.spawn(function()
while State.farming do
character = player.Character
if not character then
autoSpawn()
task.wait(1)
continue
end
humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
humanoid = character:FindFirstChild("Humanoid")
if not humanoidRootPart or not humanoid then
task.wait(0.5)
continue
end
if humanoid.Health <= 0 then
autoSpawn()
-- Update refs setelah respawn
character = player.Character
if character then
humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
humanoid = character:FindFirstChild("Humanoid")
end
task.wait(1)
continue
end
local target = getNextTarget()
if not target then
StatusLabel.Text = "Mencari mob..."
StatusLabel.TextColor3 = Color3.fromRGB(255, 200, 80)
TargetLabel.Text = "Target: -"
task.wait(1)
continue
end
local targetHum = target:FindFirstChild("Humanoid")
local targetHRP = target:FindFirstChild("HumanoidRootPart")
if not targetHum or not targetHRP or targetHum.Health <= 0 then
task.wait(0.1)
continue
end
TargetLabel.Text = "Target: " .. target.Name
StatusLabel.Text = "Farming: " .. target.Name
StatusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
equipWeapon(State.selectedWeapon)
while State.farming and target and target.Parent do
targetHum = target:FindFirstChild("Humanoid")
targetHRP = target:FindFirstChild("HumanoidRootPart")
if not targetHum or targetHum.Health <= 0 then break end
if targetHRP then
humanoidRootPart.CFrame = CFrame.new(targetHRP.Position + Vector3.new(0, 0, 3.5))
end
attackMob()
task.wait(0.12)
end
task.wait(0.2)
end
end)
end
StartBtn.MouseButton1Click:Connect(function()
if State.farming then stopFarming() else startFarming() end
end)
-- Border glow
task.spawn(function()
local colors = {
Color3.fromRGB(255, 165, 0),
Color3.fromRGB(255, 100, 0),
Color3.fromRGB(255, 200, 50),
}
local i = 1
while ScreenGui.Parent do
TweenService:Create(BorderFrame, TweenInfo.new(1.5, Enum.EasingStyle.Sine), {
BackgroundColor3 = colors
})😛lay()
i = (i % #colors) + 1
task.wait(1.5)
end
end)
buildMobButtons()
buildWeaponButtons()
print("[AutoFarm] GUI loaded! by wiliambot1")