--Copy the following code from line #3-39 and paste it in the command bar. Then press enter.


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)
