how would i...

how do i make it so i stil take dmg under trees i want it to only not dmg u if ur in a cave/underground tick function

scoreboard players add #timer timer_one 1
execute as @a if score #timer timer_one matches 13858.. if predicate 404:overworld_sky run damage @p 10 404:sky
execute as @a if score #timer timer_one matches 13858 run execute run tellraw @s ["",{color:"red",bold:true,text:"Dont forget to set your spawn with "},{color:"gold",bold:true,underlined:true,text:"/Trigger setspawn"}]
# Initialize score if missing
execute as @a unless entity @s[scores={usedsetspawn=0..}] run scoreboard players set @s usedsetspawn 0

# ENABLE trigger only if they haven't used it
scoreboard players enable @a[scores={usedsetspawn=0}] setspawn

# FAILSAFE: Immediately block access if usedsetspawn = 1 (prevents 2nd use even if scores overlap)
scoreboard players reset @a[scores={usedsetspawn=1}] setspawn

# If trigger was activated and not used before, run the action
execute as @a[scores={setspawn=1.., usedsetspawn=0}] run function 404:trigger_spawn

execute as @e[type=player,scores={deaths=1..}] run function 404:tp_spawn with storage 404:spawnpoint args```
Continue to help post