Advertisement
Joriangames

Damage Indicator Script

Oct 25th, 2021
4,323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. --[[
  2. Thanks for using this script
  3. This script is made by Joriangames/Problox Studio Scripts
  4. Want to know how to use this and script explanation?
  5. Check the video here: https://youtu.be/6aqejsMdy3c
  6.  
  7. ]]
  8.  
  9. local TS = game:GetService("TweenService")
  10. local Tinfo = TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)
  11.  
  12. local DamageEvent = game.ReplicatedStorage.DamageEvent --You can remove this line since it is actually unnecessary
  13. local DamageBoard = game.ReplicatedStorage.DamageBoard
  14.  
  15. local Red = Color3.fromRGB(255, 0, 0)
  16. local Green = Color3.fromRGB(95,111,64)
  17.  
  18.  
  19.  
  20. game.Players.PlayerAdded:Connect(function(plr)
  21.     plr.CharacterAdded:Connect(function(char)
  22.        
  23.         local hum = char:WaitForChild("Humanoid")
  24.         local humH = hum.Health
  25.        
  26.         hum.HealthChanged:Connect(function(Health)
  27.             if Health < humH and Health > 0 then
  28.                
  29.                 local Damage = math.floor(humH - Health)
  30.                 print(Damage.." Damage was taken")
  31.                
  32.                 local BoardClone = DamageBoard:Clone()
  33.                 BoardClone:FindFirstChild("Damage").Text = Damage
  34.                
  35.                 local maxH = hum.MaxHealth
  36.                 BoardClone.Damage.TextColor3 = Green:lerp(Red, Damage / maxH)
  37.                
  38.                
  39.                 BoardClone.Parent = char.HumanoidRootPart
  40.                 BoardClone.Damage:TweenSize(UDim2.new(1,0,1,0), "InOut", "Quint", 0.3)
  41.                                
  42.                 wait(0.3)
  43.                
  44.                 local UIupTween = TS:Create(BoardClone, Tinfo, {StudsOffset = BoardClone.StudsOffset + Vector3.new(0,1,0)})
  45.                 local textFade = TS:Create(BoardClone.Damage, Tinfo, {TextTransparency = 1})
  46.                                
  47.                 UIupTween:Play()
  48.                 textFade:Play()
  49.                
  50.                 game:GetService("Debris"):AddItem(BoardClone, 0.5)
  51.             end
  52.             humH = hum.Health
  53.         end)
  54.        
  55.     end)
  56. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement