GAG2 Auto Harvest Script – Open src best

GAG2 Auto Harvest Script – Open src best

Grow a Garden 2 15 hours ago
6 views
GAG2 Auto Harvest Script – Open src best Keyless

Description

Open Source code by @qkaspq

Join Discord for more sources and the best script to grow a garden 2

Features
Compatible Executors

Script

task.spawn(function()
	local _0xlp = game:GetService("Players").LocalPlayer
	local function _0xgetPlayerFarm()
		local _0xgardens = workspace:FindFirstChild("Gardens")
		if not _0xgardens then return nil end
		local _0xmyName = string.lower(_0xlp.Name)
		local _0xmyDisplayName = string.lower(_0xlp.DisplayName)
		local _0xmyId = tostring(_0xlp.UserId)
		for _, _0xplot in ipairs(_0xgardens:GetChildren()) do
			local _0xowner = _0xplot:GetAttribute("Owner")
			local _0xownerId = _0xplot:GetAttribute("OwnerUserId")
			if _0xowner then
				local _0xlowerOwner = string.lower(tostring(_0xowner))
				if _0xlowerOwner == _0xmyName or _0xlowerOwner == _0xmyDisplayName or string.find(_0xlowerOwner, _0xmyName, 1, true) then
					return _0xplot
				end
			end
			if _0xownerId and tostring(_0xownerId) == _0xmyId then
				return _0xplot
			end
		end
		return nil
	end
	local _0xNetworking = require(game:GetService("ReplicatedStorage").SharedModules.Networking)
	local _0xcollectEvent = _0xNetworking and _0xNetworking.Garden and _0xNetworking.Garden.CollectFruit
	if not _0xcollectEvent then return end
	while true do
		local _0xfarm = _0xgetPlayerFarm()
		local _0xplants = _0xfarm and _0xfarm:FindFirstChild("Plants")
		if _0xplants then
			for _, _0xplant in ipairs(_0xplants:GetChildren()) do
				local _0xseedName = _0xplant:GetAttribute("CorePartName") or _0xplant:GetAttribute("SeedName") or _0xplant:GetAttribute("Fruit")
				if _0xseedName then
					local _0xplantId = _0xplant:GetAttribute("PlantId") or _0xplant.Name:match("^%d+_(.+)$")
					if _0xplantId then
						pcall(function() _0xcollectEvent:Fire(_0xplantId, "") end)
					end
					local _0xfruitsFolder = _0xplant:FindFirstChild("Fruits")
					if _0xfruitsFolder then
						for _, _0xfruit in ipairs(_0xfruitsFolder:GetChildren()) do
							local _0xfruitId = _0xfruit:GetAttribute("FruitId") or _0xfruit.Name:match("^%d+_%d+_(.+)$") or ""
							if _0xplantId then
								pcall(function() _0xcollectEvent:Fire(_0xplantId, _0xfruitId) end)
							end
						end
					end
				end
			end
		end
		task.wait(0.1)
	end
end)

Comments (0)

No comments yet. Be the first!