I recently figured out a way to make a Highlight only appear over other objects in front of the Highlight. This effect requires 2 separate Highlights and a duplicate of the object you want to highlight. In this quick tutorial I’ll be explaining how to achieve this effect.
Video of the effect
How to create the effect
-
Add a desired
AlwaysOnTopHighlightto the [Blue] object you want to highlight. -
Create a clone of the [Blue] object.
-
Convert the [Red] cloned object to be glass with 1
Transparency. If the object is aMeshPartor contains them, give them anyTextureIDto remove all specular highlights. -
Scale the [Red] object towards the camera so that it appears the same size from the camera’s perspective while always remaining in front of the other highlighted [Blue] object.
-
Give the [Red] object an
OccludedHighlightwith 1FillTransparencyand 0.9999999OutlineTransparencyso that it’ll mask out theHighlightof the [Blue] object while remaining nearly invisible.

Now when the player is behind a wall, the Occluded Highlight gets blocked by the wall, while the AlwaysOnTop Highlight appears over it:

Place file
Highlight_Over_Objects1.rbxl (172.1 KB)
Notes
When the glass meshes used for the masking Highlight object have a WrapTarget and are parented under a character with a Humanoid, they can’t be fully invisible (Transparency has to be at 0.9999999).
SpecialMeshes don’t need to have a TextureId, they already don’t have specular highlights when they’re glass and fully trasparent.
Using shift lock causes issues with the effect since the masking Highlight object doesn’t seem to get updated to the real character correctly:

Objects with this effect don’t get highlighted over other objects that also have the effect:

