I’m using CFrame.fromAxisAngles to calculate a plane to carry out calculations however CFrame.fromAxisAngle(Vector3.new(0,0,0), 0) returns 0, 0, 0, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN.
How do I prevent this from happening?

Your calculations for midPoint is wrong. You can do:

local midpoint = p1.CFrame:lerp(p2.CFrame, 0.5)

Lerp returns a point In between two points based on an alpha (a number between 0 and 1). For example, if alpha is 0, it’ll return the first point (start), if alpha is 1, it’ll return the second point (the end), if alpha is 0.5, it’ll return a point in between the start and the end