How to rotate a part according to mouse's target surface

So, in many building games, you might have seen as the structure rotates according to the mouse’s target surface, I need to do that. Any help?