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

how do i make dead npcs despawn?

Asked by 2 years ago

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

Log in to vote
1
Answered by 2 years ago

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
I think your code might be the answer! Brioche_Noodle 45 — 2y
Ad
Log in to vote
0
Answered by 2 years ago

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()

Answer this question