I’m making a game where I have several thousand zombies, as I kill a few thousand of them, they get cleaned up after 60 seconds or so. It seems like the longer that I play my game and kill the zombies the larger the deleteDeferred
step becomes. If I immediately go kill 1000 zombies it’s not really a problem. It only becomes one after 45 minutes of playing or so. Eventually it starts to spend 5-6 seconds on deleteDeferred
with really nothing happening in the game at all.
The zombie models are R6 and are all capable of becoming ragdolls, when dying they ragdoll and despawn after 60 seconds. They are despawned via task.delay
over 60 seconds and then I call :Destroy()
on their character model. Originally I was thinking that perhaps I was making a Debris:AddItem
call but that doesn’t seem to be the case.
I’ll probably end up reusing the zombie characters rather than despawning them, but I’d really like to understand the problem a bit better anyway.
I’m not really needing any scripting help as much as being educated on what triggers the deleteDeferred
step. Any help with that would be greatly appreciated.