Is there a efficient way to get the player who killed a humanoid?
I'm working on a boss fight project, a lot of people will be fighting the boss and hit him nonstop, i'm not sure how to get the player that killed the boss... help, plox?
Is there a efficient way to get the player who killed a humanoid?
I'm working on a boss fight project, a lot of people will be fighting the boss and hit him nonstop, i'm not sure how to get the player that killed the boss... help, plox?
Make a modle with values of each players hit damage, and when he dies then fire and compare which is greater
dead = false
winner = {}
function ondied()
if dead == false
then
dead = true
for i,v in pairs(script.Parent:GetChildren())
if v.ClassName ==("NumberValue")
then
if winner[1] < last[1]
then
last[1] = winner
end
last[1] = v
end
if game.Players:FindFirstChild(winner[1].Value) ~= nil
then
--Blah you put your stuff here
end
end
script.Parent.Parent.Parent.Humanoid.Died:connect(ondied)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Uhm but that gets the player who did most damage on the final knock out, doesn't it? There could be people with very good weapons and do a lot of damage, i've seen scripts where low damagers can get the kill too.
then just make 1 value and change it. to last hit.