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

How do you make the size of a billboard gui the same?

Asked by 8 years ago

So I'm sure you've played games where there are marks on top of players. I'm trying to create a billboard gui that will make the size the same. Any idea on how to do that?

0
Can you clarify your question a bit more? DepressionSensei 315 — 8y
0
Ok so, I want there to be a billboardgui right. In that billboardgui I have some text written (a textlabel) but whenever my camera moves away the text gets absurdly big, how do I stop that and make it have a definite size RedPandaEmperor 45 — 8y

1 answer

Log in to vote
0
Answered by
mnaj22 44
8 years ago

The BillboardGui stays the same size actually, it's just your view of the blocks getting smaller. Let me put it this way, if the BillboardGui was 100 pixels by 100 pixels it will always be 100 pixels by 100 pixels. The correct question should be, how do I change the size of the BillboardGui depending on the distance of the camera to the part in which the BillboardGui is on. I have tried to do this before though and the only conclusion I came up with is to: 1. Find the Position of the Camera.

To find the position of the camera put a local script in something in which the player spawns with and put in,

local cam = game.Workspace.Camera

After this you should find the X, Y, and Z of the camera to make a vector3 of it.

local x = cam.CFrame.X
local y = cam.CFrame.Y
local z = cam.CFrame.Z
local pos = Vector3.new(x, y, z)

Now to find the distance of the camera from the part you should name the part something, lets say you name it "BillboardPart". Now subtract the position of the Camera from the position of the Part.

local distance = (pos - game.Workspace.BillboardPart.Position).magnitude

Now just change the size of the BillboardGui depending on the distance using UDim2.

game.Workspace.BillboardPart.BillboardGui.Size = UDim2.new( , , , ,) -- Whatever you want to put

Hopefully this answered your question, or helped in some way.

Ad

Answer this question