Npc doesnt look for another enemy after killing one

Hello. I need help with debugging a problem with this killer / soldier npc im working on. I am going to show the full code. Whenever i run the game, for some reason, this error shows up and the npc doesnt shoot.

yeah so uh for comparison, this is what uses to happen, however it still had the same error message. I am willing to show some code tho if anyone can help :pleading_face:

it probably dies and becomes nil, do pcall or a check before following. or try comparing the primarypart position rather than the models position

2 Likes

yeah, I have a function for finding targets and it returns the humanoidrootpart. ill see if anything is wrong with that function :+1:

1 Like

YO DUDE THANK YOU! I NOTICED MY PROBLEM! THANK YOU :grin: !!!

1 Like

youre welcome, was it them dying or was it the position?

1 Like

turns out, you were right i would return the models position instead of the humanoidrootpart. seriously though thanks

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.