MCreator issue tracker has been migrated to GitHub.
Existing tickets have been migrated to GitHub. Please open new tickets on the GitHub tracker instead. If you do not have a GitHub account, all feature requests and bug reports from forums are still considered and checked by the maintainers.
There is a trigger "Entity attacked" that does (will do) this.
Entity attacked currently provides the attack target but will provide the source in the future too and by checking the source and target type using "is entity subtype" procedure block you will be able to achieve this (check if the source or the target was player).
For killing, not attacking, there is an "Entity killed by entity" trigger with a similar planned future.
Deeply related ticket: https://mcreator.net/tracker/issue/45976