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.
COMMUNITY QUESTION
Finding out what player killed an NPC?
1 answer
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
3 comments
0
Or... Just like the linkedsword, tag the humanoid. Put an ObjectValue inside of the humanoid and make the value, the actual player's humanoid. When the npc dies you use a died event and check what the value is, give the point to that specific player.
0
Only involves like 3 lines of code.
0
I see, thanks for all the help! I'll experiment w/ the different things and see what I can do.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
I was about to say, "There was a wiki page about it!" but they have rewritten the wiki page and I understand how you can't find it