How to get all parts in shapecast?

I have this snippet for Ray where it makes it easy to get all parts that ray sees instead of getting only 1 part but anyways I don’t know how to convert it so it works for :Shapecasting instead of Ray

local WorldRoot = game:GetService("Workspace")

local BasePart = script.Parent
local direction = BasePart.CFrame.UpVector
local params = RaycastParams.new()

function findAllPartsOnRay(ray)
	local targets = {}
	repeat
		local target = game.Workspace:FindPartsInRegion3WithIgnoreList(ray, targets)
		if target then
			table.insert(targets, target)
		end
	until not target
	return targets
end

while task.wait() do
	local f = WorldRoot:Shapecast(BasePart,direction,params)
end

As a result of Shapecast you will get a RaycastResult. So in your case, to get the Parts it detected, you would do RaycastResult.Instance.