detect if player has 10 blocks of ceiling

Is there a way to detect if player has 10 blocks of ceiling, even when it is not directly above them?

Continue to help post