How to make a BillboardGui shrink/grow bigger?
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:
01 | game.Players.PlayerAdded:connect( function (player) |
02 | repeat wait() until player.Character |
04 | local bg = Instance.new( "BillboardGui" ) |
05 | bg.Parent = player.Character.Head |
06 | bg.Adornee = player.Character.Head |
07 | bg.Size = UDim 2. new( 1 , 0 , 1 , 0 ) |
08 | bg.StudsOffset = Vector 3. new( 0 , 2 , 0 ) |
10 | local frame = Instance.new( "Frame" ) |
12 | frame.Size = UDim 2. new( 1 , 0 , 1 , 0 ) |
13 | frame.BackgroundTransparency = 1 |
14 | frame.BackgroundColor 3 = Color 3. new( 1 , 1 , 1 ) |
16 | local text = Instance.new( "TextLabel" ) |
18 | text.Position = UDim 2. new( 0.25 , 0 , 0.25 , 0 ) |
19 | text.Size = UDim 2. new( 0.5 , 0 , 0.5 , 0 ) |
20 | text.Text = player.Name |
21 | text.TextColor = BrickColor.new( "Bright green" ) |
22 | text.FontSize = Enum.FontSize.Size 24 |
23 | text.BackgroundTransparency = 1 |
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.