How to Group undead mobs in a datapack?

I have this in my datapack, in a JSON file:

{ "values": [ "minecraft:drowned", "minecraft:husk", "minecraft:phantom", "minecraft:skeleton", "minecraft:skeleton_horse", "minecraft:stray", "minecraft:wither", "minecraft:wither_skeleton", "minecraft:zoglin", "minecraft:zombie", "minecraft:zombie_horse", "minecraft:zombie_villager", "minecraft:zombified_piglin" ]
}

The path to the file is namespace/tags/entity_types/undead.json

But when I try this:

execute at @s run effect give @e[distance=0.5..4,type=undead] instant_health 1 1

it won't work.

Will anyone help?

1 Answer

You missed a hashtag:

execute at @s run effect give @e[distance=0.5..4,type=#undead] instant_health 1 1
1

You Might Also Like