How to teleport a player who kills a npc?

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.

1 Like
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 
				task.wait(1) -- change to your time
				script:Destroy() -- or, you could disable it and enable it whenever you want

Result :

robloxapp-20220403-1833358.wmv (1.5 MB)

1 Like