This is how I do:
Enemy must be a part of the Family Enemies
Enemies must have at least an instance variable
Enemies must have Platform behavior
inst_is_hurt type bool default false so when in my case the player sword hit that enemy the ins_is_hurt is changed to True
Then in some Everytick in your game
Check if Family Enemies pick by UID or any method you want and do check if Enemy.ins_is_hurt = true then move the enemy
Moves enemy with Move forward by pixels 1 positive or -1 negative. Note: in my case is 1 or -1 but can be any value you need