Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make it so the tool deletes when an npc dies?

Asked by 3 years ago
Tool = script.Parent
if script.Parent.Humanoid.Health == 0 then
    Tool:Destroy()
end

i wanna make it so when an NPC dies it automatically drops the tool but apparently this script doesn't work how do i make it drop the tool?

0
also i figured out on how to code block :) dylancrazy88 20 — 3y
0
before i answer, what script is this in? pepsymax 73 — 3y
0
the model dylancrazy88 20 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Try putting a script in a tool (which is inside the NPC I assume), and paste this:

local tool = script.Parent

tool.Parent:WaitForChild("Humanoid").Died:Connect(function()
    tool:Destroy()
end)
Ad

Answer this question