Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I get BillboardGui's to change size with distance?

1 answer

✓ Accepted answer

A UDim2 value is composed of two UDims (hence the name). Each UDim then has two components: an Offset (the first component) and then a Scale (the second component). All in all, A UDim2 is {X.Scale, X.Offset, Y.Scale, Y.Offset}. You may already know how these act in a regular ScreenGui. For example, setting the Size to {1, 0, 1, 0} makes it so that the gui fills the whole screen. To make it so that the BillboardGui scales with distance, set the size of the BillBoardGui to {x, 0, y, 0} and set the size of its children to {x, 0, y, 0}, too.

For example, the hierarchy would look like this:

-- Part
-- -- BillboardGui : Size = {1, 0, 1, 0}
-- -- -- Frame : Size = {1, 0, 1, 0}

When you set the Size to {1, 0, 1, 0}, you make the BillboardGui act as if it is 1 stud big. Setting it to {2, 0, 2, 0} makes it act as if it's 2 studs big. Setting both the Size of the BillboardGui and the Frame to {2, 0, 2, 0} makes it so that it is 4 studs big since these two values multiply.

This discussion is preserved as it was. New answers, comments, and votes are closed.