You could detect when a player is near that entitie and make it be invulnerable and when the player is not near that entitie it will be damageble again. Obviusly this means that when the player is near the mob can't die from any kind of damage and not just the player but it is a basic solution.
Hey there,
is it possible to make an entity invulnerable against a player but not against every other damage like over entities or fall damage?
You could detect when a player is near that entitie and make it be invulnerable and when the player is not near that entitie it will be damageble again. Obviusly this means that when the player is near the mob can't die from any kind of damage and not just the player but it is a basic solution.