I make a script that does damage and shows you the damage done with a BillboardGUI but when i get further away from the BillboardGUI it starts to get bigger and bigger. How do i make the Billboard disappear at a certain distance, or slowly get smaller? Here is the script
01 | light.Touched:connect( function (hit) |
02 |
03 | if not db then return end |
04 | db = false |
05 | local opponent = hit.Parent:findFirstChild( "Humanoid" ) or hit.Parent.Parent:findFirstChild( "Humanoid" ) |
06 | if opponent and opponent ~ = player.Character.Humanoid then |
07 | local effect = Instance.new( "BillboardGui" , opponent.Parent.Head) |
08 | effect.Size = UDim 2. new( 0 , 200 , 0 , 200 ) |
09 | wait() |
10 | local distance = 5 |
11 | local text = Instance.new( "TextBox" ) |
12 | text.Parent = effect |
13 | text.Text = tool.Animation.Script.Damage.Value |
14 | text.TextSize = 60 |
15 | text.TextColor 3 = Color 3. new( 255 , 0 , 0 ) |
If you use Scale instead of Offset to size both your BillboardGui and the Textbox, it will not get any bigger as you walk away.
UDim2 syntax: { xScale, xOffset }, { yScale, yOffset }
In your case, this would look something like:
1 | --For the BillboardGui |
2 | effect.Size = UDim 2. new(. 2 , 0 ,. 2 , 0 ) |
3 |
4 | --For the TextBox |
5 | text.Size = UDim 2. new(. 2 , 0 ,. 05 , 0 ) |