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

How would I found out who killed a person?

Asked by
Relatch 550 Moderation Voter
9 years ago

This is not a request! I'm just simply asking how to extend my current script.

I have people in a match, and if one player dies/gets killed I want it to print who killed the player.

game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
            print(player.Name .. " has died!")
        end)
    end)
end)

1 answer

Log in to vote
0
Answered by
Tesouro 407 Moderation Voter
9 years ago

Usually, weapons shoot parts holding a value, to recognize where did it come from. It can be a string with the player's name or an object value leading to the player, so if the 'bullet' kills the victim, it can find the killer and give him the KO score, for example. If you are talking about melee weapons, it's even easier, since the tool is a child of the character.

Ad

Answer this question