ADVERTISEMENTREMOVE ADS
Wheat Auto Harvest
47,272 views
Script Preview
Description
ADVERTISEMENTREMOVE ADS
2 Lines • 9.99 KiB
local v0=game:GetService("Players");local v1=game:GetService("RunService");local v2=game:GetService("ReplicatedStorage");local v3=game:GetService("CollectionService");local v4=v0.LocalPlayer;local v5=v4:WaitForChild("PlayerGui");if v5:FindFirstChild("AutoHarvesterGui") then v5.AutoHarvesterGui:Destroy();end local v6=false;local v7;local v8=15;local v9="";local v10="Inactive";local v11=Vector3.new(0,0,0);local v12={};local v13=0;local v14=0.5;local v15={wheatFoundCount=0,harvestAttempts=0,harvestSuccesses=0,harvestFailures=0,avgScanTime=0,lagSpikes=0,lastScanTime=0,totalScans=0,cacheHits=0};local v16={"ReplicatedStorage.Remotes.Harvest not found - Check if remote exists","Player character not found - Character may not be spawned","HumanoidRootPart missing - Character corrupted or loading","No wheat found in range - Move closer to wheat or increase range","Harvest remote failed - Server may be rejecting requests","Script permissions denied - LocalScript may be in wrong location","Workspace access denied - Game security settings blocking access","Connection already exists - Previous instance not properly cleaned up","Memory overflow - Too many objects being processed","Network timeout - Server not responding to harvest requests","Performance degradation - Script running too frequently","GetDescendants lag - Workspace scanning causing framerate drops"};local v17={"IMPLEMENTED: Use CollectionService to track wheat instead of GetDescendants","IMPLEMENTED: Cache wheat positions and only rescan when player moves significantly","IMPLEMENTED: Add scan cooldown to prevent excessive workspace queries","IMPLEMENTED: Use distance-based culling before expensive operations","PERFORMANCE: Implement spatial partitioning/region-based scanning","PERFORMANCE: Implement yielding/coroutine-based scanning to spread load","OPTIMIZATION: Batch harvest requests instead of individual calls","OPTIMIZATION: Add cooldown between harvests to prevent server spam","OPTIMIZATION: Use raycasting to verify wheat is actually reachable","OPTIMIZATION: Implement priority system (closest wheat first)","USER EXPERIENCE: Add wheat counter display in GUI","USER EXPERIENCE: Add range slider to adjust harvest distance","USER EXPERIENCE: Add visual indicators showing wheat being targeted","USER EXPERIENCE: Add sound feedback for successful harvests","STABILITY: Add memory usage monitoring and cleanup","STABILITY: Implement heartbeat frame time monitoring","STABILITY: Add automatic pause when FPS drops below threshold","DEBUGGING: Add real-time performance metrics display","DEBUGGING: Log individual wheat positions and distances","DEBUGGING: Track server response times for harvest requests"};local v18;pcall(function() v18=v2:WaitForChild("Remotes",5):WaitForChild("Harvest",5);end);local v19=Instance.new("ScreenGui");v19.Name="AutoHarvesterGui";v19.Parent=v5;local v22=Instance.new("Frame");v22.Size=UDim2.new(0,250,0,150);v22.Position=UDim2.new(0,10,0,10);v22.BackgroundColor3=Color3.new(0.1,0.1,0.1);v22.BorderSizePixel=1;v22.BorderColor3=Color3.new(0.3,0.3,0.3);v22.Parent=v19;local v29=Instance.new("TextLabel");v29.Size=UDim2.new(1,0,0,20);v29.Position=UDim2.new(0,0,0,0);v29.BackgroundTransparency=1;v29.Text="Auto Harvester (Optimized)";v29.TextColor3=Color3.new(1,1,1);v29.TextSize=14;v29.Font=Enum.Font.SourceSans;v29.Parent=v22;local v39=Instance.new("TextLabel");v39.Size=UDim2.new(1,0,0,20);v39.Position=UDim2.new(0,0,0,25);v39.BackgroundTransparency=1;v39.Text="Status: " .. v10 ;v39.TextColor3=Color3.new(0.8,0.8,0.8);v39.TextSize=12;v39.Font=Enum.Font.SourceSans;v39.Parent=v22;local v48=Instance.new("TextButton");v48.Size=UDim2.new(0,60,0,25);v48.Position=UDim2.new(0,10,0,50);v48.BackgroundColor3=Color3.new(0,0.6,0);v48.Text="START";v48.TextColor3=Color3.new(1,1,1);v48.TextSize=12;v48.Font=Enum.Font.SourceSans;v48.Parent=v22;local v57=Instance.new("TextButton");v57.Size=UDim2.new(0,60,0,25);v57.Position=UDim2.new(0,80,0,50);v57.BackgroundColor3=Color3.new(0.6,0,0);v57.Text="STOP";v57.TextColor3=Color3.new(1,1,1);v57.TextSize=12;v57.Font=Enum.Font.SourceSans;v57.Parent=v22;local v66=Instance.new("TextButton");v66.Size=UDim2.new(0,60,0,25);v66.Position=UDim2.new(0,150,0,50);v66.BackgroundColor3=Color3.new(0.4,0.4,0.4);v66.Text="EXIT";v66.TextColor3=Color3.new(1,1,1);v66.TextSize=12;v66.Font=Enum.Font.SourceSans;v66.Parent=v22;local v75=Instance.new("TextLabel");v75.Size=UDim2.new(1, -20,0,40);v75.Position=UDim2.new(0,10,0,80);v75.BackgroundColor3=Color3.new(0.2,0.05,0.05);v75.BorderSizePixel=1;v75.BorderColor3=Color3.new(0.5,0.1,0.1);v75.Text="No errors";v75.TextColor3=Color3.new(1,0.5,0.5);v75.TextSize=10;v75.Font=Enum.Font.SourceSans;v75.TextWrapped=true;v75.TextXAlignment=Enum.TextXAlignment.Left;v75.TextYAlignment=Enum.TextYAlignment.Top;v75.Parent=v22;local v91=Instance.new("TextButton");v91.Size=UDim2.new(0,80,0,20);v91.Position=UDim2.new(0,10,0,125);v91.BackgroundColor3=Color3.new(0.2,0.3,0.5);v91.Text="Copy Error Log";v91.TextColor3=Color3.new(1,1,1);v91.TextSize=10;v91.Font=Enum.Font.SourceSans;v91.Parent=v22;local function v100(v106) local v107=os.date("%H:%M:%S");local v108="[" .. v107 .. "] " .. v106 ;v9=v9 .. v108 .. "\n" ;v75.Text=v106;print("AutoHarvester Error: " .. v106 );end local function v101(v110,v111) v10=v110;v39.Text="Status: " .. v110 ;v39.TextColor3=v111 or Color3.new(0.8,0.8,0.8) ;end local function v102() local v114="=== AUTO HARVESTER DIAGNOSTIC REPORT ===\n";v114=v114 .. "Timestamp: " .. os.date("%Y-%m-%d %H:%M:%S") .. "\n" ;v114=v114 .. "Status: " .. v10 .. "\n" ;v114=v114 .. "Harvest Remote Found: " .. ((v18 and "Yes") or "No") .. "\n" ;v114=v114 .. "Character Exists: " .. ((v4.Character and "Yes") or "No") .. "\n" ;v114=v114 .. "HumanoidRootPart Exists: " .. ((v4.Character and v4.Character:FindFirstChild("HumanoidRootPart") and "Yes") or "No") .. "\n" ;v114=v114 .. "\n=== PERFORMANCE STATISTICS ===\n" ;v114=v114 .. "Total Scans: " .. v15.totalScans .. "\n" ;v114=v114 .. "Cache Hits: " .. v15.cacheHits .. "\n" ;v114=v114 .. "Wheat Found (Last Scan): " .. v15.wheatFoundCount .. "\n" ;v114=v114 .. "Harvest Attempts: " .. v15.harvestAttempts .. "\n" ;v114=v114 .. "Harvest Successes: " .. v15.harvestSuccesses .. "\n" ;v114=v114 .. "Harvest Failures: " .. v15.harvestFailures .. "\n" ;v114=v114 .. "Success Rate: " .. (((v15.harvestAttempts>0) and math.floor((v15.harvestSuccesses/v15.harvestAttempts) * 100 )) or 0) .. "%\n" ;v114=v114 .. "Average Scan Time: " .. math.floor(v15.avgScanTime * 1000 ) .. "ms\n" ;v114=v114 .. "Last Scan Time: " .. math.floor(v15.lastScanTime * 1000 ) .. "ms\n" ;v114=v114 .. "Lag Spikes Detected: " .. v15.lagSpikes .. "\n" ;v114=v114 .. "Cached Wheat Count: " .. #v12 .. "\n" ;v114=v114 .. "\n=== IMPROVEMENT SUGGESTIONS ===\n" ;for v126,v127 in ipairs(v17) do v114=v114 .. v126 .. ". " .. v127 .. "\n" ;end v114=v114 .. "\n=== POSSIBLE ERROR CAUSES ===\n" ;for v128,v129 in ipairs(v16) do v114=v114 .. v128 .. ". " .. v129 .. "\n" ;end v114=v114 .. "\n=== ACTUAL ERRORS ENCOUNTERED ===\n" ;v114=v114 .. (((v9~="") and v9) or "No errors recorded") .. "\n" ;v114=v114 .. "\n=== TECHNICAL DETAILS ===\n" ;v114=v114 .. "RunService Connection: " .. ((v7 and "Active") or "Inactive") .. "\n" ;v114=v114 .. "Harvest Range: " .. v8 .. " studs\n" ;v114=v114 .. "Scan Cooldown: " .. v14 .. " seconds\n" ;v114=v114 .. "Script Location: " .. script.Parent.Name .. "\n" ;v114=v114 .. "Using CollectionService: Yes\n" ;v114=v114 .. "Using Caching: Yes\n" ;setclipboard(v114);v75.Text="Comprehensive diagnostic copied!";end local function v103() local v116=tick();local v117=false;if ((v116-v13)>v14) then if (v4.Character and v4.Character:FindFirstChild("HumanoidRootPart")) then local v141=v4.Character.HumanoidRootPart.Position;local v142=(v141-v11).Magnitude;if ((v142>5) or ( #v12==0)) then v117=true;v11=v141;end end end if ( not v117 and ( #v12>0)) then v15.cacheHits=v15.cacheHits + 1 ;return v12;end local v118=tick();local v119,v120=pcall(function() if ( not v4.Character or not v4.Character:FindFirstChild("HumanoidRootPart")) then return {};end local v130=v4.Character.HumanoidRootPart.Position;local v131={};local v132=v3:GetTagged("CanBeHarvested");for v136,v137 in pairs(v132) do if (v137:IsA("BasePart") and v137.Parent and (v137.Parent.Name=="Wheat")) then local v143=(v130-v137.Position).Magnitude;if (v143<=v8) then table.insert(v131,v137);end end end v15.wheatFoundCount= #v131;v15.totalScans=v15.totalScans + 1 ;v13=v116;return v131;end);local v121=tick() -v118 ;v15.lastScanTime=v121;v15.avgScanTime=(v15.avgScanTime + v121)/2 ;if (v121>0.016) then v15.lagSpikes=v15.lagSpikes + 1 ;v100("Lag spike detected: " .. math.floor(v121 * 1000 ) .. "ms scan time" );end if not v119 then v100("Failed to find wheat: " .. tostring(v120) );return v12;end v12=v120;return v120;end local function v104() if v6 then return;end local v124,v125=pcall(function() if not v18 then v100("Harvest remote not found");return;end if not v4.Character then v100("Player character not found");return;end v6=true;v101("Running",Color3.new(0,1,0));v7=v1.Heartbeat:Connect(function() if not v6 then return;end local v139=v103();if ( #v139==0) then return;end local v140=v139[1];if (v140 and v140.Parent) then v15.harvestAttempts=v15.harvestAttempts + 1 ;local v145,v146=pcall(function() v18:FireServer(v140.Name);end);if v145 then v15.harvestSuccesses=v15.harvestSuccesses + 1 ;else v15.harvestFailures=v15.harvestFailures + 1 ;v100("Harvest failed: " .. tostring(v146) );end end end);end);if not v124 then v100("Start failed: " .. tostring(v125) );v6=false;v101("Error",Color3.new(1,0,0));end end local function v105() v6=false;v101("Stopped",Color3.new(1,1,0));v12={};if v7 then v7:Disconnect();v7=nil;end end v48.MouseButton1Click:Connect(v104);v57.MouseButton1Click:Connect(v105);v66.MouseButton1Click:Connect(function() v105();v19:Destroy();end);v91.MouseButton1Click:Connect(v102);if not v18 then v100("Harvest remote not found on startup");v101("Error - No Remote",Color3.new(1,0,0));else v101("Ready",Color3.new(0,1,1));end
ADVERTISEMENTREMOVE ADS
ADVERTISEMENTREMOVE ADS




Comments
I got a bug