In addition.. you can also check to be on_solid, then trace to see if it is on a roof texture, then move it downwards diagonally so it slides off the normal of the roof, and if it hits an invisible block about 1 unit off the roof, it will start to fall again.....