local function Y(Y,u,d)d=d or 0 local R=Y.Size+Vector3.new(d*2,0,d*2)for d=1,R.X/3,1 do for T=1,R.Z/3,1 do if(T+d)%200==0 then wait()end local n=CFrame.new(Y.CFrame:PointToWorldSpace(Vector3.new(d*3,u,T*3)-Vector3.new(R.X/2,0,R.Z/2)))local P=Vector3.new(5,5,5)local J=Region3.new(n:PointToWorldSpace(-Vector3.new(P.X/2,5,P.Z/2)),n:PointToWorldSpace(Vector3.new(P.X/2,5,P.Z/2)))workspace.Terrain:ReplaceMaterial(J:ExpandToGrid(4),4,Enum.Material.Grass,Enum.Material.LeafyGrass)end end end local function u(u,d)Y(u,0,d)end local function d(Y)for d,R in pairs(workspace:GetDescendants())do if R:IsA("\066\097\115\101\080\097\114\116")and(not R:IsA("\077\101\115\104\080\097\114\116")and(not R:IsA("\084\101\114\114\097\105\110")and R.Size.Y<10))then print(R)if d%100==0 then wait()end u(R,Y)end end print("\070\073\078\073\083\072\069\068")end wait()d(2)


local function regionPaintPart(p, yC, padding)
	--[[each part is divided into smaller regions (each with a size of 4x4 studs) since some parts are rotated and regions cant be rotated]]
	padding = padding or 0
	local s = p.Size+Vector3.new(padding*2,0,padding*2)
	for x=1, s.X/3 do
		for z=1, s.Z/3 do
			if ((z+x)%200)==0 then
				wait()
			end
			local p2c = CFrame.new(p.CFrame:PointToWorldSpace(Vector3.new(x*3,yC,z*3)-Vector3.new(s.X/2,0,s.Z/2)))
			local p2s = Vector3.new(5,5,5)
			local r = Region3.new(p2c:PointToWorldSpace(-Vector3.new(p2s.X/2,5,p2s.Z/2)), p2c:PointToWorldSpace(Vector3.new(p2s.X/2,5,p2s.Z/2)))
			workspace.Terrain:ReplaceMaterial(r:ExpandToGrid(4) ,4,Enum.Material.Grass, Enum.Material.LeafyGrass)
		end
	end
end

local function FixGrassPart(p, pad)
	regionPaintPart(p, 0, pad)
end

local function FixAllGrassParts(pad)
	for _, v in pairs(workspace:GetDescendants()) do
		if v:IsA("BasePart") and not v:IsA("MeshPart") and not v:IsA("Terrain") and v.Size.Y < 10 then
			print(v)
			if (_%100)==0 then
				wait() --[[Waits every 100 parts so it doesn't freeze studio]]
			end
			FixGrassPart(v, pad)
		end
	end
	print('FINISHED')
end

wait()

FixAllGrassParts(2)
