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.
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?
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.
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?