Best way to check for a part with canquery disabled?

Ok so pretty much I have a building system in my game. Here is an example of that to help you better understand:
I want to make it so the model can ONLY be placed inside of the green barriers. There is one issue however and its that the green barriers need to have canquery off otherwise it causes some issues with other stuff in my game. The issue I am having is I am wondering what would be the best way to check if the model is inside a green barrier.

The current method I have in mind:

  • All barriers are inside of a folder
  • Cycle through that folder and getpartsboundinbox for every barrier until the model is found and if its not it wont let you place it.

Only issue with that is it seems kind of inefficient as there will possibly be hundreds of those green barriers around the map. Is there a more efficient way you could think of? All help is greatly appreciated.

Not an exact answer, but surely you can modify the other thing in your game (that has the issues when you enable canquery) so that it detects some other thing about the parts (you can set custom attributes or something).

You should add the part to your blacklist here instead of disabling CanQuery so no more interferences are made.