How to "cast to" a specific npc that is duplicated

I remember dealing with this too! So from what I understand, you have a global function that every NPC calls, you should rather have a function in every NPC that gets called seperately.