*dies randomly
That's probably because an enemy spawned on you. I tried to fix it by making it so that when an enemy spawns on the player, it disappears but that didnt work.