Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

How can you tell if player1 killed player2? [closed]

Asked by 9 years ago

Like in most games whena player kills a player he gets a "ko" but how can you tell if a player killed a player?

Locked by Shawnyg, M39a9am3R, and adark

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
4
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago
Edited 7 years ago

A recent update has disabled this functionality from transferring to the ROBLOX website. Kills can still be recorded in-game, however will not be counted on player profiles.

There is like a tag that is inserted into the player's character leading back to the originator (if that makes sense).

Say I fired a bullet from a gun, and struck you. A ObjectValue named "creator" in your character's humanoid. The value of "creator" would be me, since I am the shooter.

Roblox would be able to trace that value back to my character, and give me the knockout on my profile. Creating the leaderboard script in game is the tricky part, and we don't give out leaderboard scripts.

If you do not get rid of the creator tag after some time, there is going to be something common called "Kill stealing", so you can avoid that by adding the creator tag to debris after some time.

I have whipped up a example below;

part.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
local tag = Instance.new("ObjectValue", part.Parent.Humanoid)
tag.Value = game.Players.LocalPlayer --Assuming Local Script.
tag.Name = "creator"
game.Debris:AddItem(tag, 1) --Should delete after a second, enough for a leaderstat to read it if the person died.
end
end)

You can read about the creator value in this wiki page.

1
Note that this is only a *CONVENTION* and that not all tools will do this! (Though this is how the site tracks KOs so as far as that goes this works) BlueTaslem 18071 — 9y
Ad