Help with rendering BillboardGui healthbar

Hello,

I have an overhead BillboardGui healthbar system in my game, but there’s a problem where it clips behind player accessories.

I came up with an idea to stop this issue, but I am questioning whether it would impact the game’s performance.

  1. Enable AlwaysOnTop
  2. Create a LocalScript that stores healthbar BillboardGui objects in a table, and runs a loop, iterating through every healthbar in the table, that Raycasts every 0.1s from the CurrentCamera to the position of the BillboardGui. If there is something in the way of the Raycast, then make the health bar invisible.

I need genuine feedback and help to consider if this would be a viable way to solve my issue.
I’ve tried repositioning the BillboardGui but the results were janky and caused the healthbar to be offcentred.

Thanks

Sorry for the bump, I really need feedback on this idea and help to determine if this would impact players’ performance.

Could you try to move it above the player?

It is already positioned above the player, but I do not want to move it further for aesthetic reasons.