How to make a BillboardGui visible when looking at it?

Hello, It’s really hard for me to figure out how to make a bilboardgui visible when the player is looking at it and not intersecting each other.

Like in this image, both bilboards are showing at the same time which is not what i want:

So, how do I do like the bilboardgui closer to the center of the players screen shows up and not both at the same time?
I saw someone that made something similar and told me about something to do with getting the angle between 2 vectors, but I have no idea how to apply or use it in this case.

2 Likes

just get the one that’s closer with magnitude

2 Likes

You might be able to add a conditional (depending on how you set it up) that if the player’s humanoidrootpart’s magnitude to the object is less than that of the other object, then only display the door’s billboard gui.

4 Likes

That’s the route that I would personally recommend (though it might be a bit worse on the memory), and one that I’ve done in the past.

Have a table of all the possible parts that you can interact with within a certain area.
Figure out which one is the closest using magnitude checks (:DistanceFromCharacter())
Whichever one is the closest, make the UI visible

1 Like

But I need that the bilboard closer to the screen center shows up because i want to make multiple objects one each other and I don’t want move the character like tryng to get that perfect point to interact with one object