Check if player is under the sky

Hello guys, I need to check if the player is under the sky, like check if the player is under a cave or on the surface of the world, something like making the player burn when they see the sky as if they were undead—can that be done somehow?

Continue to help post