Advertisement
Tree_hub

HRP Health

Mar 1st, 2023
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. function createHealthbar(hrp)
  2. board =Instance.new("BillboardGui",hrp) --//Creates the BillboardGui with HumanoidRootPart as the Parent
  3. board.Name = "total"
  4. board.Size = UDim2.new(1,0,1,0)
  5. board.StudsOffset = Vector3.new(3,1,0)
  6. board.AlwaysOnTop = true
  7.  
  8. bar = Instance.new("Frame",board) --//Creates the red background
  9. bar.BackgroundColor3 = Color3.new(255,0,0)
  10. bar.BorderSizePixel = 0
  11. bar.Size = UDim2.new(0.2,0,4,0)
  12. bar.Name = "total2"
  13.  
  14. health = Instance.new("Frame",bar) --//Creates the changing green Frame
  15. health.BackgroundColor3 = Color3.new(0,255,0)
  16. health.BorderSizePixel = 0
  17. health.Size = UDim2.new(1,0,hrp.Parent.Humanoid.Health/100,0)
  18. hrp.Parent.Humanoid.Changed:Connect(function(property) --//Triggers when any Property changed
  19. hrp.total.total2.Frame.Size = UDim2.new(1,0,hrp.Parent.Humanoid.Health/100,0) --//Adjusts the size of the green Frame
  20. end)
  21. end
  22. -- -----------------------------------------------------------------------------------
  23. function createESP(c) --//Checks and calls the proper function
  24. bugfix = c:WaitForChild("Head") --// *Used so the children of the character arent nil.
  25. for i,v in pairs(c:GetChildren()) do
  26. if checkPart(v) then
  27. actualESP(v)
  28. end
  29. end
  30. if HEALTHBAR_ACTIVATED then --//If the user decided to
  31. createHealthbar(c:WaitForChild("HumanoidRootPart")) --//Calls the function of the creation
  32. end
  33. end
  34. -- -----------------------------------------------------------------------------------
  35. for i,people in pairs(players:GetChildren())do
  36. if people ~= players.LocalPlayer then
  37. currentPlayer = people
  38. --//Used for Players already in the Game
  39. createESP(people.Character)
  40. people.CharacterAdded:Connect(function(character)
  41. createESP(character)
  42. end)
  43. end
  44. end
  45. -- -----------------------------------------------------------------------------------
  46. end --//End of the entire function
  47.  
  48. createFlex()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement