Aight. So basically, I want to detect who killed who, and reward the killer with some cash. I don’t have anything so far as I have no idea where to start. I am also not sure whether to do this in my leaderstats script or the sword script (the sword aint mine / its a free model)
You can create a “creator” ObjectValue and parent it to the victim’s Humanoid in your weapons code when damaging, cleaning the creator value up after 5 seconds.
Then in your Died connection, you could check if a creator was in the dying Humanoid and get the value if it was. The value of creator should be the killer and you can do whatever you need with that.
In the future, it would be best if you looked up the answer to your problem before making a post about it because there are a few posts on this sort of thing:
The first reply of the first post I’ve listed provides some code samples for tagging humanoids with ObjectValues.
If you need anymore help beyond that, I’ll try my best.