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

How to make a BillboardGui shrink/grow bigger?

Asked by 9 years ago

Hi,

I am trying to make a nametag system for one of my games, and it works, but I am having one problem: I can't figure out how to make the nametag shrink as the camera gets farther away from it.

My code:

01game.Players.PlayerAdded:connect(function(player)
02    repeat wait() until player.Character
03 
04    local bg = Instance.new("BillboardGui")
05    bg.Parent = player.Character.Head
06    bg.Adornee = player.Character.Head
07    bg.Size = UDim2.new(1, 0, 1, 0)
08    bg.StudsOffset = Vector3.new(0, 2, 0)
09 
10    local frame = Instance.new("Frame")
11    frame.Parent = bg
12    frame.Size = UDim2.new(1, 0, 1, 0)
13    frame.BackgroundTransparency = 1
14    frame.BackgroundColor3 = Color3.new(1, 1, 1)
15 
View all 24 lines...

Does anyone know how I would make the tag shrink/grow bigger as the camera moves further away/closer to it? I considered making an invisible part, but I'm not sure that would work

Thanks.

Answer this question