hi, I'm new here and have little knowledge of commands and especially not executes. i got these from a walk through, but cant get them to work in my loop.mcfunction within a datapack.
execute as @e[tag=custom_mob1,type=minecraft:silverfish] at @s store result entity @e[type=minecraft:armor_stand,tag=custom_mob1,limit=1,sort=nearest] Rotation float 1 run data get entity @s Rotation
execute as @e[tag=custom_mob1,type=armor_stand] at @s unless entity @e[type=silverfish,tag=custom_mob1,distance=0..1] run kill @s
U should specify what u want to do, these commands are typed correctly. Give more info, what version ur doing it on and what ur trying to do. These commands make so armor stand looks same direction as sivler fish and armor stand gets killed when it isnt inside silverfish, if u want to stick armor stand to silverfish u should change Rotation to Pos so armor stand will copy position data from silverfish and apply on itself.
sorry about not being specific, the armor stand is invisible and inside of the silverfish, which is also invisible. the head of the armor stand is a custom model for the barrier block, which looks like a scorpion, and the armor stand already follows the silverfish as a passenger. my problem stems from the fact that when the silverfish dies the armor stand stays there, instead of being killed by the command. I cannot find the problem though, because everything is correct as you said, and my data pack format is too.