Is there a way to make FastCast projectiles pierce?

Hello, I’m making a TD game using FastCast as a projectile module, and I wanted to implement piercing to the game, but I’m clueless about how. Are there ways to make the projectile keep going and stop after hitting a certain number of enemies?

FastCast is just a module to fire Ray-marched projectiles, I personally use SecureCast for security reasons and smoothness across all clients - However, you’d need some skills to change its framework to achieve something you’d like.

If I remember, I did something like this when I once used it; On an impact find the hit instance’s thickness if not thick enough fire another projectile.

local MAX_DEPTH = 3
local MAX = 9999

-- or use a table to set the max-depth/strength - needs calculations.

function FireCast(origin, direction)
   -- some ting..
end

function OnHit(castedBullet, position, direction, raycastResult)
    local params = RaycastParams.new()
    params.FilterDescendantInstances = {raycastResult.Instance}
    params.RaycastFilterType = Enum.RaycastFilterType.Include

    local endPos = direction * MAX
    local endDirection = -direction

    local thicknessRay = workspace:Raycast(endPos, endDirection, params)
    local thickness = thicknessRay and (position - thicknessRay.Position).Magnitude or MAX
    local pierceCount = castedBullet:GetAttribute("PierceCount") or 0 -- I dont remeber how fast cast exactly works, and if the castedBullet is actually provided once hit.
    
    if pierceCount < 3 and thickness <= MAX_DEPTH then -- you can maybe add energy loss to make the bullet droop down relative to thickness..
        castedBullet:SetAttribute("PierceCount", pierceCount+1)
        FireCast(thicknessRay.Position, direction)
    end

    -- Do damaging,etc here...
end

No, it is impossible