A naive solution would be to cast a ray to center of the part, but this only tests if that point is visible, not whether the whole part is. See this image for an example of what I mean.
Well, I am going to give you an obvious solution to see whether a part is visible or not.
See by using an If statement you can easily check if something is of a certain value or even if it plainly exists like so.
if part.Transparency == 1 then print("Part is not visible") end
and if you use an else after print you can see if it is visible as well.
if part.Transparency == 1 then print("Part is not visible") else print("Part is visible") end
I also looked at the photo, but I wasn't sure if you wanted it to see if a part is visible once the ray-cast has hit the object or if you just simply wanted a way to see if a object is visible, if you want the ray-cast just add a comment to this saying so.