Advertisement
DarkusBlox

Damage/Heal Indicator

Aug 28th, 2024
991
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | Source Code | 0 0
  1. -- Subscribe to @darkusblox for more :)
  2.  
  3. local humanoid = script.Parent:FindFirstChild("Humanoid")
  4. local HP = humanoid.Health
  5.  
  6. local IndicatorGui = script.Parent:FindFirstChild("IndicatorGui")
  7.  
  8. humanoid.Changed:Connect(function()
  9.     if HP > humanoid.Health then
  10.         local damage = humanoid.Health - HP
  11.        
  12.         local newGui = IndicatorGui:Clone()
  13.         newGui.TextLabel.TextColor3 = Color3.fromRGB(255,0,0)
  14.         newGui.TextLabel.Text = damage
  15.         newGui.Parent = script.Parent
  16.         newGui.StudsOffset = Vector3.new(math.random(-3,3),0.5,math.random(-2,2))
  17.         newGui.Enabled = true
  18.         HP = humanoid.Health
  19.         task.wait(0.5)
  20.         newGui:Destroy()
  21.     elseif HP < humanoid.Health and HP ~= 0 and humanoid.Health ~= 0 then
  22.         local heal = humanoid.Health - HP
  23.  
  24.         local newGui = IndicatorGui:Clone()
  25.         newGui.TextLabel.TextColor3 = Color3.fromRGB(0,255,0)
  26.         newGui.TextLabel.Text = "+"..heal
  27.         newGui.Parent = script.Parent
  28.         newGui.StudsOffset = Vector3.new(math.random(-3,3),0.5,math.random(-2,2))
  29.         newGui.Enabled = true
  30.         HP = humanoid.Health
  31.         task.wait(0.5)
  32.         newGui:Destroy()
  33.     end
  34. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement