You can write your topic however you want, but you need to answer these questions:
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
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.
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
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.
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.
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.
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