Hello! I want to detect who killed a npc them tp them to a certain part. How would I achieve this?
Detect when a humanoid’s health is 0 then move the players humanoid to a part’s position
If it’s by a weapon, you could place a value on the npc, so when a player attacks, the value is changed to the player. Upon the npc death, bring the player’s humanoid root part to the selected position.
local Humanoid = script.Parent.Humanoid -- put it inside a Npc function KillNpc() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local Killer = tag.Value if Killer ~= nil then (Killer).Character:MoveTo(Vector3.new(2,2,2)) task.wait(1) -- change to your time script:Destroy() -- or, you could disable it and enable it whenever you want end end end end Humanoid.Died:connect(KillNpc)
robloxapp-20220403-1833358.wmv (1.5 MB)