Bug Where Creatures Don't Properly Despawn

Hello, there’s an issue I’ve been wanting to fix for months. When creatures take damage and die, their death animation doesn’t play. Instead, a few seconds later, they reappear at the spot where they died, and then disappear again after a few more seconds. This issue persists even if only one creature is spawned. I can’t seem to find anyone who knows a solution… How can I fix this? It’s really frustrating.