How can I make NPC's seek cover?

I want to make an AI that seeks cover.
A problem is probably gonna be that some platforms are gonna move.
I haven’t really seen anything about it on Roblox and I also have no idea beside just making lots of raycast/objectcasts, but that would lag eventually since I try to make a horde type shooter and most enemies have guns and other projectiles to attack.

An alternative would be pre-designing “areas of cover” which the NPC’s could flee to.
These can be BasePart’s.

This introduces a new complication: is it actually cover?

You can check if it’s in the sight of enemies separately. Then add the areas of cover which are out of sight to a table that can be used by the AI to immediately know which areas are safe.

Let me know how this works.
Thank you