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

[Solved]I'm trying to make the body parts disappear when the npc dies, but it's not working?

Asked by
Sorukan 240 Moderation Voter
5 years ago
Edited 5 years ago

I only want the body parts of the npc to disappear so that the scripts i plan on adding will continue to run but the body parts won't disappear?

--//Variables
local hum = script.Parent:WaitForChild('Humanoid')

--//Died
hum.Died:Connect(function()
    for i,v in pairs(script.Parent:GetChildren()) do
        if v then
            local bodyPart = v:FindFirstChildOfClass('Part')

            if bodyPart then
                bodyPart:Destroy()
            end
        end
    end
end)

1
Instead of using FindFirstChildOfClass, i used IsA and it worked. Sorukan 240 — 5y
0
Delete the question then Ziffixture 6913 — 5y
1
It told me not to delete it incase people in the future also have the same problem that i do. Sorukan 240 — 5y
0
Sorukan is right. All too often people are deleting their questions once they have found a solution to their problem. This makes the solution they received unavailable to others who might just have the same issue they were having. Questions should never have to be deleted and should be kept for archival purposes. User#24403 69 — 5y

Answer this question