Vector math with dot product

I’m having some problems with vector math, specifically dot product.
Basically, I’m trying to get the scalar value from 2 directional vectors that represents how closely aligned they are… so exactly what dot product does right?
Here is where my problem comes, I keep getting either a Nan value, 1, or 0.

local targetVector = workspace.Part1.CFrame.Position
for i = 1, totalRays do
    local d = rayDirections[i]:Dot(targetVector.Unit)
    interest[i] = math.max(0, d) -- interest is where I store the results
                                 -- math.max(0, d) is to only store positive values

Any help?