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
COMMUNITY QUESTION
How do I make so that the body of my NPC despawn whenever killed?
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.

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