tag @s add temp
execute as @a[distance=..250,gamemode=!spectator] if score @s ctf_ID = @n[tag=temp] ctf_ID at @s run function pctf:logic/items/lucky_block/effects/invulnerable/start {ticks: "240", seconds: "12"}
tag @s remove temp