I was wondering what the function or method is to find out what player killed an NPC/Other Player, I've tried searching the wikia's, forums, etc and I can't find anything for it. I know there's a way to do this because I've seen someone mention being able to do it, however I can't remember where I saw it.
Programming this would involve creating an entire framework involving multiple scripts with many variable components, but the basics are:
--1: Find the part of the weapon script that kills the NPC --2: Add a value to the NPC with the name of the player --3: When the NPC is deleted, first get the name of the player from that value