local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character:WaitForChild("HumanoidRootPart")
local TELEPORT_OFFSET = Vector3.new(0, 0, 3)
local CLICK_INTERVAL = 0.1
local RESCAN_INTERVAL = 0.1
local MAX_INDEX = 200
local isActive = false
local currentClickPart = nil
local foundPath = ""
local farmThread = nil
local rescanThread = nil
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-- GUI
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
local oldGui = player.PlayerGui:FindFirstChild("AutoFarmTool")
if oldGui then oldGui:Destroy() end
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AutoFarmTool"
screenGui.ResetOnSpawn = false
screenGui.IgnoreGuiInset = true
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
screenGui.Parent = player.PlayerGui
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 270, 0, 240)
frame.Position = UDim2.new(0, 20, 0, 20)
frame.BackgroundColor3 = Color3.fromRGB(18, 18, 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, 10)
local stroke = Instance.new("UIStroke")
stroke.Color = Color3.fromRGB(60, 60, 60)
stroke.Thickness = 1
stroke.Parent = frame
local function makeLabel(text, posY, color, bold, size)
local l = Instance.new("TextLabel")
l.Size = UDim2.new(1, -14, 0, 22)
l.Position = UDim2.new(0, 7, 0, posY)
l.BackgroundTransparency = 1
l.TextColor3 = color or Color3.fromRGB(200, 200, 200)
l.Font = bold and Enum.Font.GothamBold or Enum.Font.Gotham
l.TextSize = size or 12
l.Text = text
l.TextXAlignment = Enum.TextXAlignment.Left
l.TextTruncate = Enum.TextTruncate.AtEnd
l.Parent = frame
return l
end
local function makeBtn(text, posY, color)
local b = Instance.new("TextButton")
b.Size = UDim2.new(1, -14, 0, 38)
b.Position = UDim2.new(0, 7, 0, posY)
b.BackgroundColor3 = color
b.TextColor3 = Color3.fromRGB(255, 255, 255)
b.Font = Enum.Font.GothamBold
b.TextSize = 14
b.Text = text
b.BorderSizePixel = 0
b.Parent = frame
Instance.new("UICorner", b).CornerRadius = UDim.new(0, 6)
return b
end
local titleLabel = makeLabel("๐ Auto Farm", 5, Color3.fromRGB(255, 255, 255), true, 15)
local pathLabel = makeLabel("Path: not scanned", 30, Color3.fromRGB(120, 220, 120))
local statusLabel = makeLabel("Status: Idle", 52, Color3.fromRGB(180, 180, 180))
local rescanInfo = makeLabel("Rescan: every 0.5s", 74, Color3.fromRGB(100, 200, 255))
local clickLabel = makeLabel("Click: โ", 96, Color3.fromRGB(255, 200, 100))
local scanBtn = makeBtn("๐ SCAN NOW", 122, Color3.fromRGB(30, 100, 200))
local toggleBtn = makeBtn("โถ START", 165, Color3.fromRGB(0, 160, 70))
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-- Click Firing
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
local function fireClick(clickPart)
if not clickPart or not clickPart.Parent then return end
local detector = clickPart:FindFirstChildOfClass("ClickDetector")
if detector then
local ok = pcall(fireclickdetector, detector)
if not ok then
pcall(function() detector.MouseClick:Fire(player) end)
end
clickLabel.Text = "Click: ClickDetector โ"
return
end
local prompt = clickPart:FindFirstChildOfClass("ProximityPrompt")
if prompt then
pcall(fireproximityprompt, prompt)
clickLabel.Text = "Click: ProximityPrompt โ"
return
end
clickLabel.Text = "Click: nothing found โ"
end
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-- Path Resolvers
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-- Path A: workspace[i].Fruit.ClickPart
local function tryPathA(i)
local obj = workspace:GetChildren()[i]
if not obj then return nil end
local fruit = obj:FindFirstChild("Fruit")
if not fruit then return nil end
return fruit:FindFirstChild("ClickPart")
end
-- Path B: workspace[i]:GetChildren()[j].ClickPart
local function tryPathB(i, j)
local obj = workspace:GetChildren()[i]
if not obj then return nil end
local child = obj:GetChildren()[j]
if not child then return nil end
return child:FindFirstChild("ClickPart")
end
-- Path C: workspace.TycoonN.Constant.Trees[i][j].ClickPart
-- Covers Tycoon1 through Tycoon10
local function tryPathC(n, i, j)
local tycoon = workspace:FindFirstChild("Tycoon" .. n)
if not tycoon then return nil end
local constant = tycoon:FindFirstChild("Constant")
if not constant then return nil end
local trees = constant:FindFirstChild("Trees")
if not trees then return nil end
local treeObj = trees:GetChildren()[i]
if not treeObj then return nil end
local innerObj = treeObj:GetChildren()[j]
if not innerObj then return nil end
return innerObj:FindFirstChild("ClickPart")
end
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-- Scan (all 3 paths)
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
local function scan()
-- Path A
for i = 1, MAX_INDEX do
local cp = tryPathA(i)
if cp then
return cp, string.format("PathA [%d].Fruit.ClickPart", i)
end
end
-- Path B
local wsChildren = workspace:GetChildren()
for i = 1, MAX_INDEX do
local obj = wsChildren[i]
if obj then
for j = 1, #obj:GetChildren() do
local cp = tryPathB(i, j)
if cp then
return cp, string.format("PathB [%d][%d].ClickPart", i, j)
end
end
end
end
-- Path C: Tycoon1 through Tycoon10
for n = 1, 10 do
local tycoon = workspace:FindFirstChild("Tycoon" .. n)
if tycoon then
local constant = tycoon:FindFirstChild("Constant")
if constant then
local trees = constant:FindFirstChild("Trees")
if trees then
local treeList = trees:GetChildren()
for i = 1, #treeList do
local innerList = treeList[i]:GetChildren()
for j = 1, #innerList do
local cp = tryPathC(n, i, j)
if cp then
return cp, string.format("PathC Tycoon%d Trees[%d][%d].ClickPart", n, i, j)
end
end
end
end
end
end
end
return nil, "not found"
end
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-- Teleport
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
local function teleportTo(clickPart)
if not clickPart or not clickPart.Parent then return end
local cf = clickPart.CFrame
rootPart.CFrame = cf * CFrame.new(TELEPORT_OFFSET)
end
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-- Auto Farm Loop
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
local function stopFarm()
isActive = false
if farmThread then task.cancel(farmThread) farmThread = nil end
if rescanThread then task.cancel(rescanThread) rescanThread = nil end
toggleBtn.Text = "โถ START"
toggleBtn.BackgroundColor3 = Color3.fromRGB(0, 160, 70)
statusLabel.Text = "Status: Stopped"
end
local function startFarm()
isActive = true
toggleBtn.Text = "โน STOP"
toggleBtn.BackgroundColor3 = Color3.fromRGB(180, 40, 40)
-- Rescan thread: keeps finding a fresh ClickPart if current one disappears
rescanThread = task.spawn(function()
while isActive do
if not currentClickPart or not currentClickPart.Parent then
statusLabel.Text = "Status: Rescanning..."
local cp, path = scan()
currentClickPart = cp
foundPath = path
pathLabel.Text = "Path: " .. path
if cp then
statusLabel.Text = "Status: Found โ farming"
else
statusLabel.Text = "Status: Nothing found"
end
end
task.wait(RESCAN_INTERVAL)
end
end)
-- Farm thread: teleport + click loop
farmThread = task.spawn(function()
while isActive do
if currentClickPart and currentClickPart.Parent then
teleportTo(currentClickPart)
task.wait(0.1)
fireClick(currentClickPart)
end
task.wait(CLICK_INTERVAL)
end
end)
end
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-- Button Logic
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
scanBtn.MouseButton1Click:Connect(function()
statusLabel.Text = "Status: Scanning..."
pathLabel.Text = "Path: scanning..."
task.spawn(function()
local cp, path = scan()
currentClickPart = cp
foundPath = path
pathLabel.Text = "Path: " .. path
if cp then
statusLabel.Text = "Status: Ready"
toggleBtn.Active = true
else
statusLabel.Text = "Status: Not found"
end
end)
end)
toggleBtn.MouseButton1Click:Connect(function()
if isActive then
stopFarm()
else
if not currentClickPart then
-- Auto-scan first if nothing scanned yet
statusLabel.Text = "Status: Scanning..."
task.spawn(function()
local cp, path = scan()
currentClickPart = cp
foundPath = path
pathLabel.Text = "Path: " .. path
if cp then
startFarm()
else
statusLabel.Text = "Status: Nothing found โ scan first"
end
end)
else
startFarm()
end
end
end)
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-- Character respawn handling
-- โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
player.CharacterAdded:Connect(function(newChar)
character = newChar
rootPart = newChar:WaitForChild("HumanoidRootPart")
if isActive then
stopFarm()
task.wait(1)
startFarm()
end
end)
Comments
Hi I'm _ItsMeRerka_ if you wanna to help to my script comment below and if u using PC executors can you say this script is working on PC or. But anyways thx for using my script. I already hit 553 downloads on my script ๐ Thx for all who using my script. And I be happy if you just give some feedback to me.