Maybe I’m using it wrong, but it looks like they are running in series.
Code(Module Script):
task.desynchronize()
local self: ObjectMeta = self
local Filter = table.clone(self.FilterDescendantsInstances)
local function ShootRay(Origin: Vector3, Direction: Vector3, Filter: {any})
local RaycastParam = RaycastParams.new()
RaycastParam.FilterType = Enum.RaycastFilterType.Exclude
RaycastParam:AddToFilter(Filter)
local Raycast = workspace:Raycast(Origin, Direction*self._RayParams.MaxDistance, RaycastParam)
if Raycast then
if not Raycast.Instance:IsA("BasePart") then
return
end
if not self._RayParams.IgnoreTransparentParts then
return
end
if Raycast.Instance.Transparency == 1 then
table.insert(Filter, Raycast.Instance)
Raycast = ShootRay(Origin, Direction, Filter)
end
end
return Raycast
end