on/off switch using /trigger
is there a way to add an on/off switch using /trigger this is what i have so far but it just loops infinitely
load.mcfunction: scoreboard objectives add trail trigger
tick.mcfunction: scoreboard players enable @a trail execute as @a[scores={trail=1..}] run function namespace:trail_tag execute as @a[tag=trailtag] run function namespace:trail_func
namespace:trail_tag: execute store success score @s hasTag if entity @s[tag=trailtag] execute if score @s hasTag matches 0 run tag @s remove trailtag execute if score @s hasTag matches 1 run tag @s add trailtag scoreboard players reset @s trail
namespace:trail_func execute at @s unless block ~ ~-1 ~ air run particle sculk_charge_pop ~ ~1 ~ .5 .5 .5 0.01 1 execute at @s unless block ~ ~-1 ~ air run particle soul_fire_flame ~ ~1 ~ .5 .5 .5 0.01 1