I am making a Ko and Wo leaderboard and know how to find wos but I just cant figure out how you can find who killed someone which means I can't make the ko column count correctly (it doesnt count anything at all).
How to find who killed a player?
2 answers
The thing is, no one actually "kills" someone. I don't have that much time so here is a quick summary: The way of counting kills is by "tagging" the player, within whatever script you use for your attack. Examples can be shown on the "linked sword". When a player dies due to this attack, the player that fired the attack is tagged, and that is put into further code into making a "Ko" system. It's easy with gears, could get tricky with other attacks. I'd love to help you out more, but your question seems more of a request. You have no script whatsoever, and want a Ko system handed to you, without even stating details.
I found this in models on ROBLOX, I hope this helps. Made by: Demonzombietoy
function onPlayerEntered(newPlayer)
while true do
if newPlayer.Character ~= nil then break end
wait(5)
end
local humanoid = newPlayer.Character.Humanoid
humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )
newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )
end
function Send_DB_Event_Died(victim, killer)
local killername = "unknown"
if killer ~= nil then killername = killer.Name end
print(victim.Name, " was killed by ", killername)
if shared["deaths"] ~= nil then
shared["deaths"](victim, killer)
print("Death event sent.")
end
end
function Send_DB_Event_Kill(killer, victim)
print(killer.Name, " killed ", victim.Name)
if shared["kills"] ~= nil then
shared["kills"](killer, victim)
print("Kill event sent.")
end
end
function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
local deaths = stats:findFirstChild("Wipeouts")
deaths.Value = deaths.Value + 0
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
Send_DB_Event_Died(player, killer)
handleKillCount(humanoid, player)
end
end
function onPlayerRespawn(property, player)
if property == "Character" and player.Character ~= nil then
local humanoid = player.Character.Humanoid
local p = player
local h = humanoid
humanoid.Died:connect(function() onHumanoidDied(h, p) end )
end
end
function getKillerOfHumanoidIfStillInGame(humanoid)
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
local killer = tag.Value
if killer.Parent ~= nil then
return killer
end
end
return nil
end
function handleKillCount(humanoid, player)
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
if killer ~= nil then
local stats = killer:findFirstChild("leaderstats")
if stats ~= nil then
local kills = stats:findFirstChild("KOs")
if killer ~= player then
kills.Value = kills.Value + 0
else
kills.Value = kills.Value - 0
end
Send_DB_Event_Kill(killer, player)
end
end
end
game.Players.ChildAdded:connect(onPlayerEntered)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Sorry, had to get a note here. Please stop reposting the same answer. We have an edit button.
Sorry, I tried fixing it over and over, I thought I did something wrong with my text. Turns out I used the code block incorrectly.
Alright. I removed the note. It's just when you post, delete, repost an answer, if anyone is subscribed to the answer messages in our Discord channel it will just keep beeping people to check it. Don't be too worried about getting downvoted in the first few minutes of a post being up, just edit the answer.