local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local LP = Players.LocalPlayer local Rayfield do local ok, lib = pcall(function() return loadstring(game:HttpGet("https://sirius.menu/rayfield"))() end) if not ok or not lib then ok, lib = pcall(function() return loadstring(game:HttpGet("https://raw.githubusercontent.com/SiriusSoftwareLtd/Rayfield/main/source.lua"))() end) end if not ok or not lib then error("[AutoFarm] Failed to load Rayfield UI library") end Rayfield = lib end local function getRemote(...) local node = ReplicatedStorage:WaitForChild("Shared", 5) and ReplicatedStorage.Shared:WaitForChild("Network", 5) and ReplicatedStorage.Shared.Network:WaitForChild("Remotes", 5) if not node then return nil end for _, name in ipairs({...}) do node = node:WaitForChild(name, 5) if not node then return nil end end return node end local BuildingSuccess = getRemote("Building", "Success") local BuildingBegin = getRemote("Building", "Begin") local PlotCollect = getRemote("Plot", "Collect") local State = { AutoFarm = false, AutoCollect = false, FloorDelay = 0.05, -- delay between floor fires CollectCycle = 0.05, } -- ============ Helpers ============ local function getMaxFloors() local ok, value = pcall(function() local label = LP.PlayerGui :WaitForChild("Windows", 2) :WaitForChild("Upgrades", 2) :WaitForChild("Upgrades", 2) :WaitForChild("Floors", 2) :WaitForChild("TextLabel", 2) return label.Text end) if not ok or type(value) ~= "string" then return 0 end local n = tonumber(value:match("(%d+)")) return n or 0 end local function fireBuildingSuccess() if not BuildingSuccess then return false end local ok = pcall(function() BuildingSuccess:FireServer(0) end) return ok end local function fireBuildingBegin() if not BuildingBegin then return false end local ok = pcall(function() BuildingBegin:FireServer() end) return ok end local function fireTerminalPrompt() local plots = workspace:FindFirstChild("Plots") if not plots then return false end local plot = plots:FindFirstChild(tostring(LP.UserId)) if not plot then return false end local prompt = plot:FindFirstChild("Terminal") and plot.Terminal:FindFirstChild("Button") and plot.Terminal.Button:FindFirstChild("Attachment") and plot.Terminal.Button.Attachment:FindFirstChild("ProximityPrompt") if not prompt then return false end if typeof(fireproximityprompt) == "function" then local ok = pcall(fireproximityprompt, prompt) return ok end return false end local function collectPlot(plotNumber) if not PlotCollect then return end pcall(function() PlotCollect:FireServer(plotNumber) end) end task.spawn(function() while true do if State.AutoFarm then local floors = getMaxFloors() if floors > 0 then fireBuildingBegin() task.wait(0.1) for _ = 1, floors do if not State.AutoFarm then break end if not fireBuildingSuccess() then fireTerminalPrompt() end task.wait(State.FloorDelay) end else fireTerminalPrompt() task.wait(0.5) end end task.wait(0.1) end end) task.spawn(function() while true do if State.AutoCollect then for plot = 1, 8 do if not State.AutoCollect then break end collectPlot(plot) task.wait(0.05) end end task.wait(State.CollectCycle) end end) local Window = Rayfield:CreateWindow({ Name = "Auto Farm | Cipher", LoadingTitle = "Auto Farm", LoadingSubtitle = "by Cipher", ConfigurationSaving = { Enabled = false }, KeySystem = false, }) local FarmTab = Window:CreateTab("🚜 Farm", nil) FarmTab:CreateSection("Automation") FarmTab:CreateToggle({ Name = "Auto Farm (Build Floors)", CurrentValue = false, Flag = "AutoFarm", Callback = function(v) State.AutoFarm = v end, }) FarmTab:CreateToggle({ Name = "Auto Collect (8 Plots)", CurrentValue = false, Flag = "AutoCollect", Callback = function(v) State.AutoCollect = v end, }) FarmTab:CreateSection("Tuning") FarmTab:CreateSlider({ Name = "Floor Fire Delay (ms)", Range = {0, 500}, Increment = 5, Suffix = "ms", CurrentValue = 50, Flag = "FloorDelay", Callback = function(v) State.FloorDelay = v / 1000 end, }) FarmTab:CreateSlider({ Name = "Collect Interval (s)", Range = {0, 30}, Increment = 1, Suffix = "s", CurrentValue = 0, Flag = "CollectCycle", Callback = function(v) State.CollectCycle = v end, }) FarmTab:CreateSection("Manual") FarmTab:CreateButton({ Name = "Run Build Once (Max Floors)", Callback = function() local floors = getMaxFloors() if floors <= 0 then Rayfield:Notify({ Title = "Auto Farm", Content = "Could not read Max Floors", Duration = 3 }) return end fireBuildingBegin() task.wait(0.1) for _ = 1, floors do if not fireBuildingSuccess() then fireTerminalPrompt() end task.wait(State.FloorDelay) end Rayfield:Notify({ Title = "Auto Farm", Content = ("Built %d floors"):format(floors), Duration = 3 }) end, }) FarmTab:CreateButton({ Name = "Collect All Plots Once", Callback = function() for plot = 1, 8 do collectPlot(plot) task.wait(0.05) end Rayfield:Notify({ Title = "Auto Farm", Content = "Collected all 8 plots", Duration = 3 }) end, }) print("[AutoFarm] Loaded | Created by Cipher")