You are able to use Raycasting to detect parts in the way between two points. In this case, the two points would be the character position and the camera position.
01 | local function GetPartsBetweenPoints(Point 0 ,Point 1 ) |
02 | local Direc = Point 1 - Point 0 |
03 | local R = Ray.new(Point 0 , Direc) |
04 | local PartsObscuring = { } |
06 | local Part = workspace:FindPartOnRayWithIgnoreList(R,PartsObscuring) |
07 | table.insert(PartsObscuring,Part) |
12 | local Obscuring = GetPartsBetweenPoints(Camera.CFrame.p, Character.HumanoidRootPart.Position) |
Using this method, every time a new obscuring part is detected, it will be added to the PartsObscuring table. This table is also used as the IgnoreList for the Ray, meaning that it will not repeatedly detect the same parts. Basically, it will one-by-one detect parts between the character and the camera (on the ray), and add them to the table. You could then used this returned table to set the transparency of the parts in the way.
Hope this helps!