I quickly looked at the solution in the thread you linked and noticed one thing.
The snippet posted was:
local p1 = ClosestPointOnPart(part1, part2.Position)
local p2 = ClosestPointOnPart(part2, part1.Position)
local minDistance = (p1 - p2).magnitude
But I think it should actually be:
local p1 = ClosestPointOnPart(part1, part2.Position)
local p2 = ClosestPointOnPart(part2, p1)
local minDistance = (p1 - p2).magnitude
After that small modification, it seemed to work fine when I tested it in studio.
EDIT: There may be some cases for where this does not work, I haven’t tested many pairs of rotations.
EDIT 2: I did find some counterexamples now.
local p1 = ClosestPointOnPart(workspace.Part1, workspace.Part2.Position)
local p2 = ClosestPointOnPart(workspace.Part2, p1)
local p3 = ClosestPointOnPart(workspace.Part2, workspace.Part1.Position)
local p4 = ClosestPointOnPart(workspace.Part1, p3)
In some cases p3 → p4 is shorter than p1 → p2, so the either the minimum distance is simply
math.min((p4 - p3).Magnitude, (p2 - p1).Magnitude)
or I am approaching the problem the wrong way. This is a little beyond me, apologies that I cannot concretely verify whether it truly works or not.
EDIT 3: Yeah, I’m approaching it the wrong way. Found a counterexample to both.