✓ Accepted answer
I know that roblox has a system with their weapons and leaderboard that when a player is killed a value is put inside the victim's humanoid and when the leaderboard finds the value (Which is an ObjectValue) it looks in that value and finds the killer's player object. You can take a closer look in Roblox's Sets in the toolbox and in their weapons. That's how I learned how to find the killer.
If that isn't enough then
function TagHumanoid(Killer, Victim)
local c = Instance.new("ObjectValue")
c.Name = "creator"
c.Value = Killer
game.Debris:AddItem(c, 5)
c.Parent = Victim.Character.Humanoid
end
Here's how I get the victim's player through a sword LOCALSCRIPT:
local Player = game.Players.LocalPlayer
Handle.Touched:connect(function(hit)
hitplr = game.Players:FindFirstChild(hit.Parent.Name)
if hitplr then
hitplr.Character.Humanoid:TakeDamage(damage)
TagHumanoid(Player, hitplr)
end
end)
If you have a gun with a moving bullet (one like manofthelol's guns) then it should work too.
1 comment
Thanks