Hello, I’m wondering how I find out who killed someone. I’ve tried looking at other topics but I dont get them. If someone can please explain to me how to do so then I’d greatly appreciate it. Thank you.
If someone did damage to another person, you can give the event or whatever is seeing that you killed someone your player. Like a value on the person who was killed by someone.
Please explain more, i dont get it.
You can make a value that is default inserted into every player and when they are hit, the person who hit them is the value.
local creator = target.Humanoid:FindFirstChild("Creator");
if (creator) then
creator:Destroy();
end
creator = Instance.new("ObjectValue");
creator.Name = "Creator";
creator.Value = player;
creator.Parent = target.Humanoid;
Assuming the variables player
and target
are the attacker and the target’s character, respectively.
It’s just a commonly used name for implementing a tagging function. Nothing special.
Whats a creator? I’ve seen them but dont understand
Thank you for this. Im just going to put a summary in what I learned from what u put.
Summary
In order to have this Creator value you must have in insert in your weapon’s script. So when a player gets damaged by your weapon it checks if their health is 0. If it is then, insert the object value from your weapon script. Then have a script which checks if that value is there when the character dies. Then make it to what u want. Again, thank you.