[FIXED] - Dead NPCs bug

Describe the bug:
When killing an npc, all scripts are removed from it, properties can’t be read and npc[scriptName] returns nil.

How do you cause this bug?

  • List the steps
    Kill an npc and try to reference a script on that npc.
    It will return nil. Also entity:FindScriptProperty(propertyName) will return nil.

Hey there @Ya_shi_shi ! :sun_with_face:

Thank you for raising this issue up over here on the Forums!
We would need additional information if possible;

  • What scripts are you using to kill the NPC?
  • How are you trying to access it?
  • What game is this occurring on ? (so we can make a copy of it to see)
    – Best to save the game/rename it; so that you may continue to work on your game on another version while we investigate this.
  • Was this seen on EGS or Stadia?

I have entered a ticket into our system so that our internal team can investigate this issue further. I await for the additional information so that I may enter it as soon as possible.

  • What scripts are you using to kill the NPC?
    This is the script:

    function Anim:Init()
  • How are you trying to access it?
    The dieing NPC has a healthScript with a HealthScript:Kill(...)-function on it.

      if me:IsA(CharacterBase) then
      print(self:GetEntity().healthScript.properties.maxHp) --[Error] healthScript:118: attempt to index field 'healthScript' (a nil value)
      print(self:GetEntity().healthScript.properties.maxHp) --Works perfectly fine: prints 1000
      if me:IsA(CharacterBase) then
  • What game is this occurring on ?
    I named the game “I SEE DEAD NPCS”

  • Was this seen on EGS or Stadia?

1 Like

Perfection!! :heart:

Updated the ticket with that information!
Thank you very much for the speedy reply!

1 Like

uh oh that’s a weird One, nobody likes dead NPC’s, i was starting in a corn field, mining some basic land (before Stasis Chamber zone, That new player area)

and i’m glad i know a little more about dead NPC’s to be careful with them :open_mouth:

I found out that there are a few other bugs regarding dead npcs.
Printing the entity reference of an npc will show something like userdata: 0x(long number) and after killing that npcs, it should still remain the same. But printing print(self:GetEntity()) before and after the npc dies will yield two different userdata values/prints.

Also dead npcs will leave a collision box like it is still alive. So killing an npc and walking towards where it died will block the player/other npcs, like there would still be a fully alive and standing npc in that spot.

Another one is related to the overhead widget. World widgets on dead npcs will remain, even after using npc:Destroy() which means that each npc with a world widget will lead to an additional permanent world widget, that can’t be deleted anymore.

Hey there @Ya_shi_shi , I have updated that ticket. That should of bumped the ticket in the queue.
Thank you for that additional information! :sun_with_face:

Started a clean post with more details and results on researches in : Updated: NPC list of bugs - Bug Reports - Crayta

Oh, i can’t delete this older thread xD nvm


This should now be fixed as of 0.g1.49.126267.

Please let us know if you continue to see this issue!

Still broken, see here: Discord

Hey there @Ya_shi_shi, I’ve gone ahead and re-opened the ticket!

Thanks for letting us know it’s still occurring. We hope to have a fix sent out to you soon :slight_smile: