To find where a part is positioned relative to another part you can use their CFrames to find an offset. This offset is the relative position and rotation between those two objects, so if you were to translate A by the offset between A and B, you'd get B. It's a bit hard to understand at first but once you start using it more it starts making more sense.
The CFrame object already has a function to find this offset; ToObjectSpace().
Here's an example of how it can be used, and how it can solve your problem.
1 | local c 0 = workspace.Part 0. CFrame |
2 | local c 1 = workspace.Part 1. CFrame |
4 | local offset = c 0 :ToObjectSpace(c 1 ) |
5 | print (offset.Position.Y) |