It's hard to just guess from screenshots of code as to what is happening. I agree that LOS is probably your best bet for this.
Since there are multiple players, maybe you'll also need a "for each players" there. Also there is no event that sets the walls to full opacity again.
I'd do something like this, but I haven't fully tested this.
This works only in a 2D space though. If you also need to check if the object is obscured by the wall depending on height... well you gotta unzip happy triangle math stuff there. Something along those lines off the top of my head.
If "wall height" < ("distance to player"/"distance to wall")*"camera height" -> player is visible. Else set wall opacity.