Sorry for your loss.
Sometimes 'stuff' happens and fish just die...
I recently had several swordtails die prompting an
Emergency Water Change. I have a lot of fish in this (110g stock) tank and discovered that I had foolishly been over feeding and just didn't notice/realize soon enough!
Assuming you have an established tank. re-evaluate the quality of the food you feed, taking care not to over feed. Also, if you're not doing at least 50% partial water changes weekly, you might want to do that. Right now, a few 25-50% water changes twice a week might be a good idea.
Now I'm not one for routine water testing, but it's good to have a test kit on hand as when there's trouble like this, you might uncover an ammonia or nitrite spike. In some rare cases, organic waste can temporarily exceed the beneficial biology to handle it. When this happens, toxic levels can develop very quickly and weaker fish will often perish.
Good luck as you get past this.