-- [[ CONFIGURATION ]] --
_G.AutoFarm = true  -- Set to false if you want to stop the script
local collectDelay = 0.5 -- How fast items are collected (seconds)
local sellDelay = 2 -- How fast items are sold (seconds)

-- [[ SERVICES & REMOTES ]] --
local player = game:GetService("Players").LocalPlayer
local reps = game:GetService("ReplicatedStorage")
local plotsFolder = workspace:WaitForChild("plots")
local remotePath = reps:WaitForChild("signals"):WaitForChild("remotes"):WaitForChild("events")

local collectRemote = remotePath:WaitForChild("requestCollection")
local sellRemote = remotePath:WaitForChild("sellInventory")

-- [[ FUNCTIONS ]] --

-- Function to optimize production speeds globally
local function updateProductionSpeeds()
    for _, object in ipairs(workspace:GetDescendants()) do
        if object.Name == "ProductionSpeed" then
            if object:IsA("NumberValue") or object:IsA("IntValue") then
                local oldValue = object.Value
                object.Value = 0.1
                print("Changed Speed from " .. tostring(oldValue) .. " to 0.1 in: " .. object:GetFullName())
            end
        end
    end
end

-- Function to thoroughly search for the player's plot
local function GetMyPlot()
    for _, p in pairs(plotsFolder:GetChildren()) do
        -- 1. Check from main plot Attributes
        if p:GetAttribute("Owner") == player.Name or p:GetAttribute("Owner") == player.UserId then
            return p
        end
        
        -- 2. Check within sub-models and PlayerPlotIcon
        local subPlot = p:FindFirstChild("plot")
        if subPlot then
            if subPlot:GetAttribute("Owner") == player.Name or subPlot:GetAttribute("Owner") == player.UserId then
                return p
            end
            
            local icon = subPlot:FindFirstChild("PlayerPlotIcon")
            if icon and (icon:GetAttribute("Owner") == player.Name or icon:GetAttribute("Owner") == player.UserId) then
                return p
            end
        end

        -- 3. Check every Value Object hidden inside the plot
        for _, obj in pairs(p:GetDescendants()) do
            if obj:IsA("StringValue") or obj:IsA("ObjectValue") then
                if obj.Value == player.Name or obj.Value == player then
                    return p
                end
            end
        end
    end
    return nil
end

-- [[ INITIALIZATION ]] --

-- Run speed optimization once at the start
updateProductionSpeeds()

-- Update any new production objects added later
workspace.DescendantAdded:Connect(function(descendant)
    if descendant.Name == "ProductionSpeed" then
        if descendant:IsA("NumberValue") or descendant:IsA("IntValue") then
            descendant.Value = 0.1
            print("New ProductionSpeed detected and set to 0.1 in: " .. descendant:GetFullName())
        end
    end
end)

-- [[ MAIN SYSTEM ]] --
print("Searching for your Plot...")
local myPlot = GetMyPlot()

-- Loop until plot is found
while not myPlot and _G.AutoFarm do
    task.wait(2)
    myPlot = GetMyPlot()
end

if myPlot then
    print("✅ Found your Plot: " .. myPlot.Name .. " | Starting Auto Farm!")
    
    -- Part 1: Auto Collection
    task.spawn(function()
        while _G.AutoFarm do
            if myPlot then
                local itemHolder = myPlot:FindFirstChild("itemHolder")
                if itemHolder then
                    for _, item in pairs(itemHolder:GetChildren()) do
                        if not _G.AutoFarm then break end
                        collectRemote:FireServer(item)
                    end
                end
            end
            task.wait(collectDelay)
        end
    end)

    -- Part 2: Auto Sell
    task.spawn(function()
        while _G.AutoFarm do
            sellRemote:FireServer()
            task.wait(sellDelay)
        end
    end)
    
else
    warn("❌ System Error: Plot not found.")
end

print("Made By namesicklyy!")
[UPD] Build a Noob Kingdom infinite money autofarm
990 views
6 months ago

infinite money autofarm

WORKING
Free

Description

autofarm by namesicklyy

Features

  • lnf money
  • autofarm

Related Scripts