Answered by
6 years ago Edited 6 years ago
The Roblox Raycasting API does not yet support developer hit test filters apart from ignoring water. Most of the time, because [hopefully] your ray is only going to pass through a few transparent parts, the best solution is to cast your ray, and if the hit part has transparency of 1 (or whatever threshold you want), add the part to the ignore list and cast the ray again. Repeat until you hit either something opaque, or nothing at all.
Note that most of the time, it's not a good idea to add a bunch of transparent items to your ignore list up front, because size of the ignore list can impact cost of the raycast considerably. I've seen code where the developer used CollectionService or Workspace:GetDescendants() to build an ignore list of hundreds of parts and passed it to every raycast call. Performance of this can be bad, particularly if these parts themselves have children (because they will be recursively searched for each ray cast).