Need a way to count how many parts are hit

Hello! I have a value known as “hitpart” that has the names of every part touched by a blast radius, problem is I don’t have a way to count them. Any suggestions?

Create an array to store the part names and use the # operator to get its count.

local partsHit = {}

local function partWasHitByBlast(part)
    -- Code for the parts being hit
    table.insert(partsHit, part)
end

-- To count how many parts were hit
#partsHit
print(#partsHit) -- Prints the number of parts hit

It kinda works, but it seems to just print “1” for every part, is there some way I can turn it into a value?

Use :GetTouchingParts function
What it does it when your part was hit, it will create a table storing the parts it’s hitting