Problem with dot product

I want to make a placement system like the Roblox dragger and I have the maths, but there’s a problem with the dot product that I use to calculate the angle of the ray normal

example

I’m using this code for getting the normal angle

local x = math.acos(math.abs(info.rayNormal.Unit.Z))

And it works perfectly until I want to get for the X side, this is what happens

The normal values get inverted

Issue

I know that the issue it’s that I’m using just the Z side, but I don’t know how to apply the X or difference between them to solve this issue

This solution doesn’t not work for what I want to achieve.

define the plane differently by 3 points on the surface. then just do what you are doing but use that definition of the normal instead