In short
When a weapon damages a Humanoid, have its server script put an ObjectValue named creator in that Humanoid with the attacker's Player as its Value, removed after a few seconds. A Script in ServerScriptService connects to each character's Humanoid.Died, adds 1 to the victim's Deaths, reads the creator tag, adds 1 to the killer's Kills in leaderstats, and fires a RemoteEvent to all clients so a LocalScript can show "Killer eliminated Victim".
- Roblox has no built-in "killed by". The creator tag is a long-standing convention in Roblox weapon scripts, and many free-model weapons already add it.
- Tag and count on the server. A kill counted by a LocalScript only exists on that player's screen.
- Let the tag expire after a few seconds, so a player who falls in lava a minute later does not give someone a kill.
Get the script
Kills and deaths leaderstats with a kill feed
A server Script that counts Kills and Deaths in leaderstats from creator tags when a character dies and sends every kill to all players for the kill feed.
-- Script in ServerScriptService named KillTracker.
-- Kills and Deaths in leaderstats from creator tags, and a kill feed event for every player.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local SHOW_PLAIN_DEATHS = true -- "Name died" when nobody gets the kill
local XP_PER_KILL = 50 -- used only if the AwardXp event exists
local killFeed = Instance.new("RemoteEvent")
killFeed.Name = "KillFeed"
killFeed.Parent = ReplicatedStorage
local function getStat(player: Player, name: string): IntValue?
local leaderstats = player:FindFirstChild("leaderstats")
local stat = leaderstats and leaderstats:FindFirstChild(name)
if stat and stat:IsA("IntValue") then
return stat
end
return nil
end
local function onDied(victim: Player, humanoid: Humanoid)
local deaths = getStat(victim, "Deaths")
if deaths then
deaths.Value += 1
end
-- Who landed the last hit in the last few seconds?
local tag = humanoid:FindFirstChild("creator")
local killer: Player? = nil
local weapon = ""
if tag and tag:IsA("ObjectValue") and tag.Value and tag.Value:IsA("Player") then
killer = tag.Value
local weaponAttr = tag:GetAttribute("Weapon")
weapon = if type(weaponAttr) == "string" then weaponAttr else ""
end
-- A killer who left, or a player who tagged themselves, does not get the kill
if killer and (killer == victim or killer.Parent ~= Players) then
killer = nil
end
if killer then
local kills = getStat(killer, "Kills")
if kills then
kills.Value += 1
end
local awardXp = ServerStorage:FindFirstChild("AwardXp")
if XP_PER_KILL > 0 and awardXp and awardXp:IsA("BindableEvent") then
awardXp:Fire(killer, XP_PER_KILL)
end
killFeed:FireAllClients(killer.DisplayName, victim.DisplayName, weapon)
elseif SHOW_PLAIN_DEATHS then
killFeed:FireAllClients("", victim.DisplayName, "")
end
end
local function onPlayerAdded(player: Player)
local leaderstats: Instance
local existing = player:FindFirstChild("leaderstats")
if existing then
leaderstats = existing
else
leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
end
for _, name in { "Kills", "Deaths" } do
local stat = Instance.new("IntValue")
stat.Name = name
stat.Parent = leaderstats
end
local function onCharacter(character: Model)
local humanoid = character:WaitForChild("Humanoid", 10)
if humanoid and humanoid:IsA("Humanoid") then
humanoid.Died:Connect(function()
onDied(player, humanoid)
end)
end
end
player.CharacterAdded:Connect(onCharacter)
if player.Character then
task.spawn(onCharacter, player.Character)
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
task.spawn(onPlayerAdded, player)
end
RoCode builds it in the place you have open in Roblox Studio, on Windows or macOS with a desktop browser; on a phone the button sends the prompt and the link to your computer. Free to start, with free credits every day. More Roblox Studio scripts
Where to put it
ServerScriptService
CreatorTag ModuleScript new
KillTracker Script new
ReplicatedStorage
KillFeed RemoteEvent (made by the script)
StarterGui
KillFeedGui LocalScript new
Settings you can change
SHOW_PLAIN_DEATHSIn the script- Also show "Name died" in the feed when nobody gets the kill, such as a fall or lava. Default:
true. XP_PER_KILLIn the script- XP for a kill, if the AwardXp event from the XP and level guide exists. 0 turns it off. Default:
50.
Your weapons must call CreatorTag before they deal damage (Step 2), or every death shows as "died" with no killer.
What a cheater can and cannot doThe tag is added by the weapon's server code and the counting is done on the server, so a cheater cannot add kills from their device. A cheater who can hit everyone (with a hacked reach, say) still gets real kills, so check distance in the weapon (anti-exploit guide).
Type-checked with luau-lsp strict against Roblox's API definitions on 14 November 2026. Not playtested in Studio yet: press Play and watch the Output window before you publish.
Prompt for RoCode
Add kills and a kill feed to my game: a CreatorTag ModuleScript in ServerScriptService that my weapons call before damage to put a creator ObjectValue in the hit Humanoid for 5 seconds, a KillTracker Script that adds Kills and Deaths to leaderstats, reads the tag when a character dies, gives the killer a kill and fires a KillFeed RemoteEvent to all clients, and a LocalScript kill feed in the top right that shows the last 5 kills and fades them out.
On this page
How kill tracking works
A Humanoid knows it died, but not why. It could have been a sword, a fall, lava or a reset. So the weapon leaves a note on the victim each time it hits: an ObjectValue named creator inside the Humanoid, pointing at the attacking Player. When the Humanoid's Died event fires, the server reads the note. If there is one, its Value is the killer.
| Moment | Where | What runs |
|---|---|---|
| The sword hits | Weapon's server Script | CreatorTag(humanoid, attacker), then TakeDamage |
| Health reaches 0 | KillTracker (server) | Deaths + 1 for the victim, Kills + 1 for the tag's player |
| Right after | KillTracker (server) | KillFeed:FireAllClients(killer, victim) |
| On every screen | KillFeedGui (client) | Adds "Killer eliminated Victim" to the top of the feed |
The tag removes itself after 5 seconds. A hit that knocks someone into lava still counts if they die within that time; a hit from a minute ago does not.
Step 1: The creator tag module
- Hover over ServerScriptService, click +, insert a ModuleScript and name it
CreatorTag. - Paste the code below.
-- ModuleScript in ServerScriptService named CreatorTag.
-- Weapons call it before dealing damage: CreatorTag(humanoid, attacker, "Sword")
local Debris = game:GetService("Debris")
local TAG_SECONDS = 5 -- the hit counts as the kill for this long
local function tagHumanoid(humanoid: Humanoid, attacker: Player, weaponName: string?)
local old = humanoid:FindFirstChild("creator")
if old then
old:Destroy()
end
local tag = Instance.new("ObjectValue")
tag.Name = "creator"
tag.Value = attacker
if weaponName then
tag:SetAttribute("Weapon", weaponName)
end
tag.Parent = humanoid
-- Debris removes the tag after TAG_SECONDS without needing a loop
Debris:AddItem(tag, TAG_SECONDS)
end
return tagHumanoid
Each new hit replaces the old tag, so the last player to hit the victim gets the kill. The name stays creator, all lower case, because that is what free-model weapons and older scripts look for.
Step 2: Tag hits in your weapons
Find the line in your weapon's server Script that damages the Humanoid, usually humanoid:TakeDamage(...), and call the module just before it. Here it is in a minimal sword Script that sits inside a Tool:
-- Script inside a Tool (with a part named Handle), named SwordDamage.
-- Damages what the blade touches, tagging each hit with the attacker for the kill feed.
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")
local CreatorTag = require(ServerScriptService:WaitForChild("CreatorTag")) :: (Humanoid, Player, string?) -> ()
local DAMAGE = 25
local HIT_COOLDOWN = 0.5 -- seconds before the same target can be hit again
local tool = script.Parent :: Tool
local handle = tool:WaitForChild("Handle") :: BasePart
local lastHit: { [Humanoid]: number } = {}
handle.Touched:Connect(function(hit: BasePart)
-- The tool's parent is the character holding it
local character = tool.Parent
local attacker = if character and character:IsA("Model") then Players:GetPlayerFromCharacter(character) else nil
if not attacker then
return
end
local victimModel = hit.Parent
local humanoid = victimModel and victimModel:FindFirstChildOfClass("Humanoid")
if not humanoid or victimModel == character or humanoid.Health <= 0 then
return
end
local now = os.clock()
if now - (lastHit[humanoid] or 0) < HIT_COOLDOWN then
return
end
lastHit[humanoid] = now
CreatorTag(humanoid, attacker, tool.Name)
humanoid:TakeDamage(DAMAGE)
end)
This sword damages on any touch while held, which is enough to test the kill feed. For a sword that only hurts while swinging, with an animation, use the sword script guide and add the same CreatorTag line before its damage. Guns work the same: call it in the server code that applies the hit (gun script guide).
Step 3: Count kills and deaths
- Insert a Script in ServerScriptService named
KillTracker. - Paste the code below. If another script already makes leaderstats (for Coins, say), this one adds Kills and Deaths to the same folder.
-- Script in ServerScriptService named KillTracker.
-- Kills and Deaths in leaderstats from creator tags, and a kill feed event for every player.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local SHOW_PLAIN_DEATHS = true -- "Name died" when nobody gets the kill
local XP_PER_KILL = 50 -- used only if the AwardXp event exists
local killFeed = Instance.new("RemoteEvent")
killFeed.Name = "KillFeed"
killFeed.Parent = ReplicatedStorage
local function getStat(player: Player, name: string): IntValue?
local leaderstats = player:FindFirstChild("leaderstats")
local stat = leaderstats and leaderstats:FindFirstChild(name)
if stat and stat:IsA("IntValue") then
return stat
end
return nil
end
local function onDied(victim: Player, humanoid: Humanoid)
local deaths = getStat(victim, "Deaths")
if deaths then
deaths.Value += 1
end
-- Who landed the last hit in the last few seconds?
local tag = humanoid:FindFirstChild("creator")
local killer: Player? = nil
local weapon = ""
if tag and tag:IsA("ObjectValue") and tag.Value and tag.Value:IsA("Player") then
killer = tag.Value
local weaponAttr = tag:GetAttribute("Weapon")
weapon = if type(weaponAttr) == "string" then weaponAttr else ""
end
-- A killer who left, or a player who tagged themselves, does not get the kill
if killer and (killer == victim or killer.Parent ~= Players) then
killer = nil
end
if killer then
local kills = getStat(killer, "Kills")
if kills then
kills.Value += 1
end
local awardXp = ServerStorage:FindFirstChild("AwardXp")
if XP_PER_KILL > 0 and awardXp and awardXp:IsA("BindableEvent") then
awardXp:Fire(killer, XP_PER_KILL)
end
killFeed:FireAllClients(killer.DisplayName, victim.DisplayName, weapon)
elseif SHOW_PLAIN_DEATHS then
killFeed:FireAllClients("", victim.DisplayName, "")
end
end
local function onPlayerAdded(player: Player)
local leaderstats: Instance
local existing = player:FindFirstChild("leaderstats")
if existing then
leaderstats = existing
else
leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
end
for _, name in { "Kills", "Deaths" } do
local stat = Instance.new("IntValue")
stat.Name = name
stat.Parent = leaderstats
end
local function onCharacter(character: Model)
local humanoid = character:WaitForChild("Humanoid", 10)
if humanoid and humanoid:IsA("Humanoid") then
humanoid.Died:Connect(function()
onDied(player, humanoid)
end)
end
end
player.CharacterAdded:Connect(onCharacter)
if player.Character then
task.spawn(onCharacter, player.Character)
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
task.spawn(onPlayerAdded, player)
end
- Died is connected again for every new character, because each respawn makes a new Humanoid.
- The killer check ignores a tag pointing at the victim and a killer who has left the server, so neither gets a free kill.
- The feed event sends display names and the weapon name, not Player objects, so the client has nothing to look up. An empty killer means "died".
- XP: if you built the XP and level system, each kill also fires its AwardXp event.
Kills and Deaths reset each session, which is normal for round-based fighting games. To keep lifetime kills, save them the way the leaderboard guide saves Coins and Wins.
Step 4: The kill feed GUI
The feed is a column in the top-right corner. New kills appear at the top, only the last five are kept, and each one fades out after a few seconds. Lines with your own name are highlighted.
- Hover over StarterGui, click +, insert a LocalScript named
KillFeedGui. - Paste the code below.
-- LocalScript in StarterGui named KillFeedGui.
-- Shows "Killer eliminated Victim" lines in the top-right for every kill the server reports.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local MAX_LINES = 5
local LINE_SECONDS = 6 -- how long a line stays before fading
local player = Players.LocalPlayer
local killFeed = ReplicatedStorage:WaitForChild("KillFeed") :: RemoteEvent
local gui = Instance.new("ScreenGui")
gui.Name = "KillFeed"
gui.ResetOnSpawn = false
local column = Instance.new("Frame")
column.AnchorPoint = Vector2.new(1, 0)
column.Position = UDim2.new(1, -16, 0, 60)
column.Size = UDim2.fromOffset(320, 200)
column.BackgroundTransparency = 1
column.Parent = gui
local layout = Instance.new("UIListLayout")
layout.SortOrder = Enum.SortOrder.LayoutOrder
layout.HorizontalAlignment = Enum.HorizontalAlignment.Right
layout.Padding = UDim.new(0, 4)
layout.Parent = column
gui.Parent = player:WaitForChild("PlayerGui")
local counter = 0
local function addLine(text: string, mine: boolean)
counter += 1
local line = Instance.new("TextLabel")
line.LayoutOrder = -counter -- newest first
line.AutomaticSize = Enum.AutomaticSize.X
line.Size = UDim2.fromOffset(0, 28)
line.BackgroundColor3 = if mine then Color3.fromRGB(120, 90, 255) else Color3.fromRGB(20, 20, 28)
line.BackgroundTransparency = 0.25
line.TextColor3 = Color3.new(1, 1, 1)
line.Font = Enum.Font.GothamBold
line.TextSize = 15
line.Text = " " .. text .. " "
line.Parent = column
Instance.new("UICorner").Parent = line
-- Keep only the newest MAX_LINES
local lines = {}
for _, child in column:GetChildren() do
if child:IsA("TextLabel") then
table.insert(lines, child)
end
end
table.sort(lines, function(a: TextLabel, b: TextLabel)
return a.LayoutOrder < b.LayoutOrder
end)
for i = MAX_LINES + 1, #lines do
lines[i]:Destroy()
end
task.delay(LINE_SECONDS, function()
if line.Parent then
local fade = TweenService:Create(line, TweenInfo.new(0.5), { BackgroundTransparency = 1, TextTransparency = 1 })
fade:Play()
fade.Completed:Wait()
line:Destroy()
end
end)
end
killFeed.OnClientEvent:Connect(function(killerName: unknown, victimName: unknown, weapon: unknown)
if type(killerName) ~= "string" or type(victimName) ~= "string" then
return
end
local me = player.DisplayName
if killerName == "" then
addLine(victimName .. " died", victimName == me)
return
end
local with = if type(weapon) == "string" and weapon ~= "" then " [" .. weapon .. "]" else ""
addLine(killerName .. " eliminated " .. victimName .. with, killerName == me or victimName == me)
end)
The UIListLayout stacks lines by LayoutOrder, and each new line gets a lower number than the last, so it goes to the top. AutomaticSize makes each line as wide as its text. Highlighting compares display names, which is fine for colour; never use display names to decide anything on the server, because two players can share one.
Step 5: Test it
- Open the Test tab, set Clients and Servers to 2 players and press Start.
- Give one player the sword from Step 2 (put the Tool in StarterPack) and hit the other until they die.
- Both windows show "Player1 eliminated Player2 [Sword]" at the top right, highlighted for both of them. The player list shows Kills 1 for the attacker and Deaths 1 for the victim.
- Make one player reset (Esc, Reset Character) with nobody hitting them. The feed shows "Player2 died" and nobody gets a kill.
- Hit someone, then wait more than 5 seconds before they die from something else. No kill is given, because the tag expired.
Common errors and fixes
Most kill feed problems are a tag that was never added or was added on the client.
Kills never go up, every death says "died"
The weapon does not call CreatorTag before its damage, or calls it from a LocalScript. Tags added on the client never reach the server. Add the call in the weapon's server Script (Step 2).
Kills and Deaths do not show on the player list
The folder must be named exactly leaderstats inside the Player. If two scripts both make a folder with that name, only one shows: let one make it and the others reuse it, as KillTracker does.
Deaths count twice
Two scripts are counting. Look for an older leaderstats script that also adds Deaths on Humanoid.Died, and remove one.
Requested module experienced an error while loading
CreatorTag has a typo, or the weapon requires it before it exists. See that error's page.
Build it with RoCode
If you would rather not edit every weapon by hand, RoCode can wire this up in the place you have open. RoCode is an independent AI agent for Roblox Studio, not made by Roblox: you describe the change in a web chat, and its Studio plugin edits the scripts in your Explorer.
Add Kills and Deaths to the leaderboard, make all my weapons give credit for kills, and show a kill feed in the top right with the weapon name.
- Can read your place first to find every weapon script and the line where it deals damage
- Writes and edits the scripts and is told to compile-check each one with Check Script
- Sets an undo point before and after each batch of changes, so Ctrl+Z steps back one batch at a time
Questions
How do I make a kills leaderboard in Roblox?
Add a Kills IntValue to leaderstats, have weapons put a creator tag on what they hit, and add 1 to the tag's player when a Humanoid dies. Step 3 has the script.
What is a creator tag in Roblox?
An ObjectValue named creator that a weapon puts inside the Humanoid it hits, with the attacking Player as its Value. It is a long-standing convention in weapon scripts, not an engine feature, and many free-model weapons already add it.
How do I know who killed a player in Roblox?
Read the creator tag in the victim's Humanoid when Humanoid.Died fires. If it is there and points at a Player, that player got the kill.
How do I make a kill feed in Roblox?
When the server counts a kill, fire a RemoteEvent to all clients with the names, and have a LocalScript add a line to a GUI list. Step 4 has the GUI.
Why does my kill counter work in Studio but not with other players?
If the counting or the tag runs in a LocalScript, it only works on that one screen. Move both to server Scripts.
Sources and further reading
- Roblox Creator Docs: Humanoid.Died. when a character dies
- Roblox Creator Docs: ObjectValue. the creator tag
- Roblox Creator Docs: Debris. removing the tag after a few seconds
- Roblox Creator Docs: In-experience leaderboards. the leaderstats folder
- Roblox Creator Docs: UIListLayout. stacking the feed lines
How the code was checked: every script on this page passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 14 November 2026). A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.