How would I go about creating a billboard GUI only active 1 at a time?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Im trying to make it so that the player can only see 1 billboard gui at a time. depending on how close they are to it

  2. What is the issue? Include screenshots / videos if possible!
    I’m trying to replicate this sorta effect. I wonder how people are able to make this.

  3. What solutions have you tried so far?
    I’ve tried but it never really got to work. I would try to detect if a handle was closer to the player than another handle but it never got to work.

Please tell me how I would be able to make this. thank you

Proximity Prompts are mainly used for this type of system

image

Proximity Prompts

2 Likes

I don’t really want to use proximity prompts as I am creating my own system, I would just like to understand how it works.

1 Like

Proximity Prompts can be customized to have their own look via script as well as they have their own built-in functions for player triggering.

I am sure the system in the video is made using custom Proximity Prompts

Customizing a ProximityPrompt is difficult and BillboardGuis allow us to have better access to the GUI, and is more general. After writing the rest of the reply I noticed that you’re right, what I thought of was too complicated, required a constantly fired event (probably RenderStepped) and not efficient at all.

Mostly invalid part: Anyway, you would need to have some GUI manager in the client, and have a variable pointing to the BilboardGui currently active. Every time you get close to the part you would manually set the visibility, I think the Active property would do that. If the variable is not nil you would turn of the BillboardGuis visibility.

Now this is a reply about how not to do it

You’d likely have to create some sort of system with scripting that shows only the closest BillboardGui to the player. Maybe you’d have a script that constantly checks the player’s distance from all the BillboardGuis, enables the closest one and disables all the others, every like 0.03 seconds or so. You’d have to figure out how to do this in a script.

It’s probably not efficient but I’m not sure how else you would do it.

Unless proximity prompts only show once at a time.

There are plenty of already coded resources on the devforum that provide easy access to customizing proximity prompts whilst doing little to no scripting

And yes, it wouldn’t be very efficient to make your own Proximity Prompt system, it would be harder than making a custom Proximity Prompt design.

Easy Proximity Prompt Customizer Model

1 Like

I’ve tried doing this but I just can’t seem to write it out, ive tried a For i, v loop but i cant detect the closest one and disable the others. This is what im stuck on.

Here’s what I might do, I would put all the BillboardGuis in a folder in StarterGui and then do this in a local script:

-- BillboardGuis is a folder with all the BillboardGuis in it
local BillboardGuis = Player.PlayerGui
local Hmr = Player.Character.HumanoidRootPart

while true do
    local ClosestGui = nil

    -- This loop will make ClosestGui equal the closest GUI
    for i, v in pairs(BillboardGuis:GetChildren()) do
        local Distance = (Hmr.Position - v.Adornee.Position).Magnitude -- this gets the distance between them

        if Distance < 10 then
            if ClosestGui == nil or Distance < (ClosestGui.Adornee.Position - Hmr.Position).Magnitude then
                ClosestGui = v
            end
        end
    end

    -- Then put code here that disables all other guis and enables ClosestGui
    wait()
end

I typed this up on mobile so it might have errors.

Probably not the best method, but it works.

1 Like

thanks man, ill try to use this if i can.

It works!!! Thank you so much for helping me out, i will look more into magnitude but thank you!!!

This also helped me too.

Glad it helped!

Magnitude basically adds the X Y and Z of a Vector3 into one number.

So if you do

 Vector3.new(3, 1, 2).Magnitude

you’d get the number 6.

Doing

(Part1.Position - Part2.Position).Magnitude 

is a formula for getting the distance between 2 parts.

1 Like

DO NOT use while true do for this. Just set the billboard GUI’s distance, or try other methods other than while true do, since if you have over 40 bill biard GUIs, it’ll be looping through 40 billboard GUIs every 0.03 seconds

If you don’t want to disable all but one ‘BillboardGui’ instance you could instead utilise their ‘AlwaysOnTop’ property.
https://developer.roblox.com/en-us/api-reference/property/BillboardGui/AlwaysOnTop

1 Like