Problem with snapping to the wall I am selecting

Hey. So it would be appreciated if somebody could get back to me ASAP. I have a question about snapping a window to the wall as a preview part. I am making a system similar to bloxburg and I am wondering if there is a better way to get the rotations of a wall and snap it rather than raycasting. I am using a model for this. Sometimes the normal will be at an angle and I want to make sure that it is always snapped to the wall and to the exact wall orientation!

Thank you very much,
Here is my attempt so far at the snapping:

self.ray = workspace:Raycast(self.unit.Position, self.unit.CFrame.LookVector * self.ray_distance)
self.normal = self.ray.Normal


if self.normal and self.wall then
	self.final_pos =  Vector3.new(Round.Round(self.mouse.Hit.Position.X, self.grid_offset), self.wall.Size.Y / 2, Round.Round(self.mouse.Hit.Position.Z, self.grid_offset))
	self.unit_cframe = CFrame.new(self.final_pos, self.final_pos + self.normal)
end`

self.cut_cframe = self.cut_object:GetPivot():Lerp(self.unit_cframe * CFrame.Angles(0, - math.rad(90), 0), 0.5)
1 Like