
Key Required
script
Lua Script•376 lines (10916 chars)
local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()
local autoFarmEnabled = false
local optimizeParticlesEnabled = false
local enabledFolders = {
LT1 = false,
LT2 = false,
LT3 = false,
LT4 = false,
LT5 = false,
LT6 = false
}
local batchDelay = 0.5
local batchQuantity = 10
local autoFarmLoop = nil
local Window = Rayfield:CreateWindow({
Name = "Object Farm",
LoadingTitle = "Object Farm",
LoadingSubtitle = "by Rayfield",
ConfigurationSaving = {
Enabled = true,
FolderName = "ObjectFarmConfig",
FileName = "ObjectFarm"
},
KeySystem = false
})
local AutoFarmTab = Window:CreateTab("Auto Farm", 4483362458)
local SettingsTab = Window:CreateTab("Settings", 4483345998)
function GetPlayerHumanoidRootPart()
local success, result = pcall(function()
local player = game.Players.LocalPlayer
if not player then
return nil
end
local character = player.Character
if not character then
return nil
end
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if not humanoidRootPart then
return nil
end
return humanoidRootPart
end)
if success then
return result
else
return nil
end
end
function GetDropFolder()
local success, result = pcall(function()
local pickFolder = game.Workspace:FindFirstChild("Pick")
if not pickFolder then
return nil
end
local normalFolder = pickFolder:FindFirstChild("Normal")
if not normalFolder then
return nil
end
local dropFolder = normalFolder:FindFirstChild("Drop")
if not dropFolder then
return nil
end
return dropFolder
end)
if success then
return result
else
return nil
end
end
function GetAllObjects()
local objects = {}
local dropFolder = GetDropFolder()
if not dropFolder then return objects end
for folderName, isEnabled in pairs(enabledFolders) do
if isEnabled then
local folder = dropFolder:FindFirstChild(folderName)
if folder then
for _, obj in ipairs(folder:GetChildren()) do
table.insert(objects, obj)
end
end
end
end
return objects
end
function PullAllObjects()
local humanoidRootPart
pcall(function()
humanoidRootPart = GetPlayerHumanoidRootPart()
end)
if not humanoidRootPart then
Rayfield:Notify({
Title = "Error",
Content = "HumanoidRootPart not found",
Duration = 3,
Image = 4483362458
})
return
end
local objects = {}
pcall(function()
objects = GetAllObjects()
end)
if #objects == 0 then
Rayfield:Notify({
Title = "Information",
Content = "No objects available to pull",
Duration = 3,
Image = 4483362458
})
return
end
local count = 0
for _, obj in ipairs(objects) do
pcall(function()
if obj:IsA("Model") then
if obj.PrimaryPart then
obj:SetPrimaryPartCFrame(humanoidRootPart.CFrame)
count = count + 1
else
local firstPart = nil
for _, part in pairs(obj:GetDescendants()) do
if part:IsA("BasePart") then
firstPart = part
break
end
end
if firstPart then
obj:PivotTo(humanoidRootPart.CFrame)
count = count + 1
end
end
elseif obj:IsA("BasePart") then
obj.CFrame = humanoidRootPart.CFrame
count = count + 1
end
end)
end
Rayfield:Notify({
Title = "Success",
Content = "Pulled " .. count .. " objects",
Duration = 3,
Image = 4483362458
})
end
function StartAutoFarm()
StopAutoFarm()
autoFarmLoop = task.spawn(function()
local objectIndex = 1
while autoFarmEnabled do
local humanoidRootPart
pcall(function()
local player = game.Players.LocalPlayer
if player and player.Character then
humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
end
end)
if not humanoidRootPart then
task.wait(0.5)
else
local objects = {}
pcall(function()
objects = GetAllObjects()
end)
if #objects > 0 then
local remainingObjects = #objects - objectIndex + 1
local batchSize = math.min(batchQuantity, remainingObjects)
local count = 0
if batchSize > 0 then
for i = 1, batchSize do
local objIndex = objectIndex + i - 1
if objIndex <= #objects then
pcall(function()
local obj = objects[objIndex]
if obj:IsA("Model") then
if obj.PrimaryPart then
obj:SetPrimaryPartCFrame(humanoidRootPart.CFrame)
count = count + 1
else
local firstPart = nil
for _, part in pairs(obj:GetDescendants()) do
if part:IsA("BasePart") then
firstPart = part
break
end
end
if firstPart then
obj:PivotTo(humanoidRootPart.CFrame)
count = count + 1
end
end
elseif obj:IsA("BasePart") then
obj.CFrame = humanoidRootPart.CFrame
count = count + 1
end
end)
end
end
end
objectIndex = objectIndex + batchSize
if objectIndex > #objects then
objectIndex = 1
end
end
task.wait(batchDelay)
end
end
end)
end
function StopAutoFarm()
if autoFarmLoop then
task.cancel(autoFarmLoop)
autoFarmLoop = nil
end
end
function ToggleParticlesOptimization(enable)
local success, error = pcall(function()
for _, instance in pairs(game:GetDescendants()) do
if instance:IsA("ParticleEmitter") or instance:IsA("Smoke") or instance:IsA("Fire") or instance:IsA("Sparkles") or instance:IsA("Trail") then
instance.Enabled = not enable
end
end
if enable then
game:GetService("Lighting").GlobalShadows = false
game:GetService("Lighting").FogEnd = 9e9
settings().Rendering.QualityLevel = 1
else
game:GetService("Lighting").GlobalShadows = true
game:GetService("Lighting").FogEnd = 500
settings().Rendering.QualityLevel = 7
end
end)
if not success then
Rayfield:Notify({
Title = "Error",
Content = "Failed to toggle particles optimization",
Duration = 3,
Image = 4483362458
})
else
Rayfield:Notify({
Title = "Success",
Content = enable and "Particles optimization enabled" or "Particles optimization disabled",
Duration = 3,
Image = 4483362458
})
end
end
AutoFarmTab:CreateSection("Controls")
AutoFarmTab:CreateButton({
Name = "Pull All Objects",
Callback = function()
PullAllObjects()
end,
})
AutoFarmTab:CreateToggle({
Name = "Enable Auto Farm (Sequential)",
CurrentValue = false,
Flag = "AutoFarmToggle",
Callback = function(Value)
autoFarmEnabled = Value
if autoFarmEnabled then
StartAutoFarm()
Rayfield:Notify({
Title = "Auto Farm",
Content = "Auto Farm activated",
Duration = 3,
Image = 4483362458
})
else
StopAutoFarm()
Rayfield:Notify({
Title = "Auto Farm",
Content = "Auto Farm deactivated",
Duration = 3,
Image = 4483362458
})
end
end,
})
AutoFarmTab:CreateSection("Object Selection")
for i = 1, 6 do
local folderName = "LT" .. i
AutoFarmTab:CreateToggle({
Name = "Enable " .. folderName,
CurrentValue = false,
Flag = "Enable" .. folderName,
Callback = function(Value)
enabledFolders[folderName] = Value
end,
})
end
SettingsTab:CreateSection("Auto Farm Settings")
SettingsTab:CreateSlider({
Name = "Batch Delay",
Range = {0.1, 5},
Increment = 0.1,
Suffix = " sec",
CurrentValue = 0.5,
Flag = "BatchDelay",
Callback = function(Value)
batchDelay = Value
end,
})
SettingsTab:CreateSlider({
Name = "Batch Size",
Range = {1, 100},
Increment = 1,
Suffix = " items",
CurrentValue = 10,
Flag = "BatchQuantity",
Callback = function(Value)
batchQuantity = Value
end,
})
SettingsTab:CreateSection("Performance")
SettingsTab:CreateToggle({
Name = "Optimize Performance",
Info = "Disables all particles and reduces graphics quality",
CurrentValue = false,
Flag = "OptimizationToggle",
Callback = function(Value)
optimizeParticlesEnabled = Value
ToggleParticlesOptimization(optimizeParticlesEnabled)
end,
})Features & Information
Autofarm with optimization
Community Comments (0)
No comments yet for this script.
