Death Tracker Script

Hey there!

I’m trying to make a script that when a player dies to another player (such as with a sword), it would print out the name of the victim and the killer. (I can do more with this, however I’d like it to first stay fairly simple so I can adjust it later.)

How can I make this happen? Or what’s a good place to start? Thanks in advance.

The easiest way is to use Roblox’s classic trick when it comes to tagging players while slaying them.

Insert an ObjectValue into the player’s humanoid when the sword damages it, name it something along the lines of “damagedBy” or whatever you would like, you can use Debris to clean up the tags after a second or so…

then you would need a script which gets fired from when a player dies and checks that tag… maybe something along the lines of this:

local players = game:GetService("Players");

--this event fires when a player joins the server
	--this event fires when a players character is added
		--wait for the humanoid
		local humanoid = character:WaitForChild("Humanoid");
		--this event fires when the humanoid dies
			--search for the tag
			local tag = humanoid:FindFirstChildWhichIsA("ObjectValue")
			--check the tag
			if tag.Name == "damagedBy" and tag.Value then
				--send message stuff here
				print(player.Name,"was killed by",tag.Value.Name);
1 Like

Interesting. I’ll tinker around with it! Thanks a bunch.

1 Like