Checking distance between gives invalid #2 vector3 expected, got nil

Hello all, I have this problem where I can’t get the distance between a turret and the target.
This is the function

the target is the player and the body is the turret

function checkDist(target)

return(body.Position - target.Position).Magnitude


Is there something wrong with it? How do I fix it? Is there maybe another way to do it?

Is there a space between return and (body.Position - target.Position).Magnitude in the actual script?
If not, then add one