Making a gui show where given parts are

Hey everybody i am struggling trying to make a gui appearing on the screen showing where certain parts are. To show you guys what i am trying to do here is a concept

As you might be able to see the part has a red gui around it which will always be there showing where it is how can i do this i have been trying for a long time now but max distance is Inf but can not be seen so im shooting for just a onscreen gui.

1 Like

Have you tried using ViewportFrames?

No however i am aware what it is i am not sure how that would apply the part in gui

ViewportFrames can show parts in a Gui or a SurfaceGui. I think this is what you’re looking for.

Yea ViewportFrames are probably your best bet, unless you want to script a very complicated 1000 lines of code script. Just make a ViewportFrame, put the parts you want to show inside of it. And make the CurrentCamera of the ViewportFrame, the localplayer’s CurrentCamera. Then, the parts will overlap everything in the workspace.

1 Like

sounds good ill try checking it out :smiley:

1 Like

Looking at this I think Viewport GUIs are used to make parts appear on the screen, like how Bubble Gum Sim uses it to make the eggs appear on screen when you open them.

Yes though im having a issue the part is not visible from 100k studs away because i am making a space openworld game

I may be interpreting this wrong; but if you’re using a BillboardGui in a BasePart you can set AlwaysOnTop to true and it will go on top of any parts in front of it.

1 Like

Yes i am aware but it is still not visible beyond 100k studs even though max dist is infinite so is there a way to bypassthis?

here is another example of what i am trying to do

Ohh… I see. You should look up WorldToScreenPoint! This tutorial shows you how to get the position and depth on the localplayer’s viewport, from a Vector3 point. Then, you can put a frame (of arrows pointing to the middle of the frame) where the screen point is.

1 Like

Or, you can use BillboardGuis (much easier). If you want to do this, make a template BillboardGui. With TextLabels and stuff named “Username”, “HealthBarContainer”, etc.

1 Like

but that is not visible from a far distance

Tho i have never really heard of WorldToScreenPoint could you give me an Example or a line of code to just get me to understand im blank rn

Well. You could look up WorldToScreenPoint… Like I said… But basically, it creates a ray that starts at a Vector3, that then points and ends at a Vector2 point on the local player’s screen. Then you can manipulate the ray to give you the end position, so you can then move a frame’s position to the Vector2 point as a UDim2. Theres also ScreenToWorldPoint I believe, which is the other way around.