Anything wrong with my NPC spawning script?

I’ve been scratching my head at this for awhile. It works fine at first but over time lag builds up as more and more zombies spawn and die. I don’t know if this is an issue with my code or with Humanoids since I’ve been told they can be quite resource intensive and possibly cause lag if there are tons being killed/spawned over long periods of time. If anyone could look over this and see if I missed any memory leaks I will be very grateful. Everything has been commented to make understanding what it does easier. I am using the SimplePath pathfinding module for Zombie pathfinding.

Redacted
1 Like