Displaying Multiple Highlights/Optimization

I’m trying to make a highlight system similar to BIG Paintball 2, where enemies are highlighted in red, and your teammates are highlighted in green. How would I go about detecting characters that are visible on the screen and putting highlights only in those objects?
Do Roblox highlights already do this? If not, how could I make a custom highlight?
The glow effect around the player also seems like an oval shape. Is that included with the highlight? How would I go about doing that?

Thanks!
image

2 Likes

Yes, you can already do that with the highlight visual effect by setting DepthMode from AlwaysOnTop to Occluded.

2 Likes

I’ve heard that there is a limit to using highlights, does this only apply to visible highlights in workspace?

Yeah, you’re right. It mentions about a limit of 31 highlights which applies both to Studio workspace and on the client.

1 Like

But if highlights are occluded or out of view, then that highlight doesn’t contribute to the limit, correct?

If the highlight limit is a problem you can edit your script so a highlight is only applied to players closest to you, alternatively you could use rays to check which players are visible (or inside of your fov if the highlights are visible through walls) and apply the highlight to these players. The second option would require more resources though.

1 Like

Even if the highlight is occluded or out of the view, it still counts as 1 in the 31 slot limit and any additional highlights will be ignored. I think that is the reason why Big Paintball 2 and Arsenal (which I think uses player highlights too) both have server sizes below 31.

It is mentioned in the documentation that

While a disabled Highlight doesn’t display, it still takes one of the 31 available Highlight slots.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.