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

how do i make dead npcs despawn?

how would i make the limbs of a dead body despawn around .5 seconds after they die? i do infact have the dumb and i dont know how to do this.

2 answers

✓ Accepted answer

insert a script in the NPC model, and paste the following:

Wait_Time = 0.5 --the time in seconds it waits before despawning

script.Parent.Humanoid.Died:Connect(function()
	wait(Wait_Time)
	script.Parent:Destroy() --Despawns the NPC model
end)

1 comment

1

I think your code might be the answer!

Respawn:


local WaitUntilDespawn = 3 --- Or Game:GetService("Players").RespawnTime


if script.Parent.Humanoid.Health == 0 then

local Cloned = script.Parent:Clone()

wait(WaitUntilDespawn)
script.Parent:Destroy()
Cloned.Parent = workspace --- Put It Anywhere you need it to be
Cloned.Name = "NPC"

No Respawn:


local WaitUntilDespawn = 3 --- Or Game:GetService("Players").RespawnTime


if script.Parent.Humanoid.Health == 0 then

wait(WaitUntilDespawn)
script.Parent:Destroy()

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