Sorry if i'm asking too many questions and giving too little answers but,
I'm trying to create some sort of code that gets the name of the killer when he kills a humanoid and sets it as the text of a surface gui named "Screen"
I don't really know where to start really.
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
--make a function that marks the victim like so function TagHumanoid(Killer, Victim) local c = Instance.new("ObjectValue") --Create an ObjectValue c.Name = "creator" --Name it creator c.Value = Killer --The Killer's player is stored in the value game.Debris:AddItem(c, 5) --The value will be deleted in 5 seconds c.Parent = Victim.Character.Humanoid --The value will be placed in the Victim's 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) --Spawn a touched event hitplr = game.Players:FindFirstChild(hit.Parent.Name) --Search for hitplr if hitplr then --If it exsists then hitplr.Character.Humanoid:TakeDamage(damage) --hitplr takes damage TagHumanoid(Player, hitplr) --HAHA I TAGGED YOU! end end)
If you have a gun with a moving bullet (one like manofthelol's guns) then it should work too.
Marked as Duplicate by M39a9am3R, ImageLabel, and Perci1
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?