I'm sure there's some brilliant, efficient, mathematical solution to this problem but because I'm not brilliant and good with math, the way I'd do it is maybe have a transparent part surrounding the top of the object and then detect whether or not it touches the floor. And then running your desired code if it does hit the floor.
Example:
3 | script.Parent.Sensor.Touched:connect( function (hit) |
4 | if hit.Name = = "Floor" and enabled then |
6 | print ( "Pin has hit the floor, running code." ) |
I tried this out in studio and it worked perfectly fine. I also tried another method with checking whenever the axis's of the desired object got below or above a certain degree and then running the script. But sadly the .Changed event does not work with rotation if the part is not anchored. However you might shine some light on that method yourself.