Applying an R15 Package Part occasionally kills my NPC. It happens very rarely and for preventing this from happening I have made a debounce of a few seconds yet it still happens very rarely. The next prevention I can take is to respawn my NPC when it dies incidentally, however, I am asking perhaps there is a solution to this rather than preventing the problem from happening or going about it.
The script I am using is the exact same as the one in the wiki:
When changing the package, be sure to call NPC.Humaniod:SetStateEnabled("Dead", false) before changing it and NPC.Humanoid:SetStateEnabled("Dead", true) afterwards. The dying is caused by the UpperTorso or Head parts being destroyed, causing the humanoid to die.
I am currently not doing that and it is still working well, the issue I am having happens very rarely but it still happens, however, I will give your idea a try. Thanks!
I am also changing the NPCâs animations after I apply the packages, should I be doing the Humanoid:SetStateEnabled when applying the animations as well?
As others would say âTry searching for Threads with the same Topic before posting them so their arenât redundant Threads thus keeping the forum nice and cleanâ.
Well, sort of. The bug we are fixing has something to do with the Humanoid not respecting whether the Dead state is enabled or not when damage is taken on the server.