Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make so that the body of my NPC despawn whenever killed?

I am making a zombie arena game. The weapons work perfectly, zombie AI is working good too. But whenever I killed the zombies the body won't despawn can anyone help me

2 comments

0

Have the 'NPC' AI detect its own death and call ':Destroy()' on itself.

0

tysm

1 answer

Script:

local Time = 3 -- Time Before Removed

script.Parent.Humanoid.Died:Connect(function() -- Detect If NPC Dead
	wait(Time) -- Wait Time
	print(script.Parent.Name.." Has Been Removed") -- Print A Message
	wait()
	script.Parent:Destroy() -- Destroy The NPC
end)

Hope It Help!

This discussion is preserved as it was. New answers, comments, and votes are closed.