Hi all,
I’m attempting to make a system similar to the Diablo style UI loot interface, where the ‘nametags’ for loot do not overlap in the event that there are several items in close proximity. Instead, they are aligned in a way that they touch edges. This makes every name of every item visible at once. Here is an image for reference (referring to the tags containing the item’s name):
What I have currently is spawning an item and simply attaching a BillboardGui with properties related to the item, with a bit of Y offset so it appears above the item. There is no other positioning happening:
-- ModuleScript in ServerStorage
local nametag = nametagCopy:Clone() -- Copy nametag (BillboardGui with a TextLabel child) from ServerStorage
nametag.Label.TextColor3 = itemData.Color.Color -- BrickColor.Color the label using rarity constants' color from the item generated
nametag.Label.Text = string.format("%s %s", itemData.Rarity, item.Name) -- Format rarity + item name
local sizeBounds = game:GetService("TextService"):GetTextSize(nametag.Label.Text, 20, Enum.Font.Fantasy, Vector2.new(400, 30)) -- Fit the size to the bounds of the text
nametag.Size = UDim2.new(0, sizeBounds.X, 0, sizeBounds.Y) -- Size it using those bounds
nametag.Parent = item -- Parent it to the item that was spawned
Unfortunately I haven’t attempted anything to replicate the goal; I have no idea how to even approach this. It seems very complicated and I’m not certain the effort to create it would be worth the (likely) hacked-together product.
Wouldn’t this require converting the 3D position of the item’s nametag to a 2D screen-space and somehow (that’s a BIG somehow) arranging them vertically/horizontally to not overlap? It seems very overwhelming, and I’m not even sure if this is possible in Roblox!
Maybe I need to re-approach how I’m creating the nametags? I really have no ideas on how I would go about doing this
Any ideas would be much appreciated, thank you!