00fjg

Untitled

Apr 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. local Distance = 200
  2.  
  3. local Color1 = Color3.new(0.2, 1, 0.1)
  4. local Color2 = Color3.new(0.8, 0, 0.1)
  5.  
  6. local Name = "GuiThing"
  7. local Me = game.Players.LocalPlayer
  8. local Char = Me.Character
  9. local Hum = Char.Humanoid
  10. local Gui = Me:findFirstChild("PlayerGui")
  11. pcall(function() Gui[Name]:remove() end)
  12. local Sc = Instance.new("ScreenGui")
  13. Sc.Name = Name
  14. Sc.Parent = Gui
  15.  
  16. function getDif(c1, c2)
  17. return Color3.new(c1.r-c2.r, c1.g-c2.g, c1.b-c2.b)
  18. end
  19.  
  20. HealthBars = {}
  21.  
  22. for i = 0, 1, 0.01 do
  23. local col2 = getDif(Color1, Color2)
  24. local pos1 = Vector2.new(-(Distance/8), 0)
  25. local pos2 = Vector2.new(-Distance, ((Distance/2)-Distance*i))
  26. local unit = (pos1 - pos2).unit
  27. local color = Color3.new(Color1.r-(col2.r*i), Color1.g-(col2.g*i), Color1.b-(col2.b*i))
  28. local g = Instance.new("Frame",Sc)
  29. g.Size = UDim2.new(0, Distance/4, 0, Distance/60)
  30. g.BorderSizePixel = 0
  31. g.BackgroundColor3 = color
  32. g.Position = UDim2.new(0.5, pos1.x, 0.5, 0) + UDim2.new(0, unit.x*Distance, 0, unit.y*Distance)
  33. table.insert(HealthBars, {gui = g, color = color})
  34. end
  35.  
  36. Hum.HealthChanged:connect(function(hp)
  37. local max = Hum.MaxHealth
  38. for i = 1, #HealthBars do
  39. local where2 = math.floor(max*(hp/i))
  40. local tab2 = HealthBars[where2]
  41. local where = math.floor(i*(hp/max))
  42. local tab = HealthBars[where]
  43. if tab then
  44. tab.gui.BackgroundColor3 = tab.color
  45. end
  46. if tab2 then
  47. tab2.gui.BackgroundColor3 = Color3.new()
  48. end
  49. end
  50. end)
  51.  
  52. wait(1)
  53.  
  54. Hum:TakeDamage(40)
Add Comment
Please, Sign In to add comment