'Kills' system help

In my fighting game, I want to add the availability for players to kill people and then a leaderstat named ‘Kills’ increases by an integer of 1.
The thing is though, I’m trying to construct the system so that it’s similar to two games.

These games individually in my opinion did a great job at handling kills, assists, etc.
(Examples below)

  • In Criminality, if you damage someone and then they leave the server, you still get the kill (‘Combat-Logging’, as the game implies).
  • In Combat Warriors, you can actually assist kills meaning multiple players can be taken into account for a kill and they all get awarded.

My question is though,
how do I achieve these features?

Thank you for the help.

2 Likes

You could store the players who damaged a user inside their character as a StringValue from latest to oldest. Then if the user leaves or their humanoid dies, give a kill to the first player inside the string and an assist to second one(there are multiple ways to do it depending on your system implementation).

Instead of a StringValue (because I think it’ll be nil when the player leaves resulting in an error), Is it possible to store this information in a table inside of a ModuleScript so I can use a function to alter the data?

One more thing, how would I sort it from latest to oldest?

1 Like

As I said there are multiple ways to achieve this, just make sure to sort whoever damages a player from newest to oldest so you can retrieve them after.

2 Likes

This topic is kinda helpful.

Would it be more efficient to sort damagers by contribution/damage dealt so that only the top 2 players are awarded the kill?
If I do this, I think the player that deals the second-most amount of damage will be awarded an assist.
In my opinion I think its better to award people for doing the most damage rather than how recently they damaged the player.
What do you think?