How to know if player is in shadows and damage him if he inst?

What I want to do is know if player is in shadows because Im making a race for my game that player cant go outside a cave or something and if he go outside he will burn because of sun. And to he dont get burned he would need be in a shadow.

Example: A vampire thing.


The best bet is checking if the player is in between the sun and the player.

Read here for more info:

For your particular use case though, you could probably just make an invisible touch box where if they’re outside the cave they can be burnt. That’d be far simpler.


It works perfectly thanks for showing me this! Will help me too much.