Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by
lucas4114 607 Moderation Voter
8 years ago

They stay the same size but how would I get them to get smaller the farther you are from them?

1 answer

Log in to vote
0
Answered by
XAXA 1569 Moderation Voter
8 years ago

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.

Ad

Answer this question