How do I center the billboard GUI and locking it's size ?
01 | game.Players.PlayerAdded:connect( function (player) |
02 | player.CharacterAdded:connect( function (char) |
03 | local plyrGuiH = Instance.new( "BillboardGui" ) |
04 | plyrGuiH.Name = "HealthOverlay" |
05 | plyrGuiH.Parent = char.Head |
06 | plyrGuiH.Adornee = char.Head |
07 | plyrGuiH.Size = UDim 2. new ( 1 , 0 , 1 , 0 , 0 , 0 ) |
08 | plyrGuiH.StudsOffset = Vector 3. new ( 0 , 1.2 , 0 ) |
11 | local frame = Instance.new( "Frame" ) |
12 | frame.Parent = plyrGuiH |
13 | frame.Size = UDim 2. new ( 0 , 180 , 0 , 10 ) |
14 | frame.BackgroundColor 3 = Color 3. fromRGB ( 9 , 33 , 49 ) |
16 | local overlay = Instance.new( "Frame" ) |
17 | overlay.Parent = frame |
18 | overlay.Name = "Overlay" |
19 | overlay.BackgroundColor 3 = Color 3. fromRGB ( 255 , 24 , 58 ) |
20 | overlay.Size = UDim 2. new ( 0 , 180 , 0 , 10 ) |
22 | game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false ) |
23 | local Humanoid = player.Character:WaitForChild( "Humanoid" ) |
24 | local HealthMath = Humanoid.Health / (Humanoid.MaxHealth) |
26 | overlay:TweenSize(UDim 2. new(HealthMath, 0 , 1 , 0 ), "Out" , "Sine" , . 5 ) |
28 | Humanoid.HealthChanged:connect( function () |
29 | local HealthMath = Humanoid.Health / (Humanoid.MaxHealth) |
30 | overlay:TweenSize(UDim 2. new(HealthMath, 0 , 1 , 0 ), "Out" , "Sine" , . 5 ) |
And how do I limit the distance of the GUI?