Advertisement
Guest User

ROBLOX HEALTH BAR BUG (FIX SCRIPT)

a guest
Nov 13th, 2021
4,113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. local HealthBar = Instance.new("ScreenGui")
  2. local Container = Instance.new("Frame")
  3. local UICorner = Instance.new("UICorner")
  4. local UIStroke = Instance.new("UIStroke")
  5. local Health = Instance.new("Frame")
  6. local UICorner_2 = Instance.new("UICorner")
  7.  
  8. HealthBar.Name = "HealthBar"
  9. HealthBar.Parent = gethui()
  10. HealthBar.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  11. HealthBar.IgnoreGuiInset = true
  12.  
  13. Container.Name = "Container"
  14. Container.Parent = HealthBar
  15. Container.AnchorPoint = Vector2.new(1, 0)
  16. Container.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  17. Container.BackgroundTransparency = 0.400
  18. Container.Position = UDim2.new(1, -60, 0, 26)
  19. Container.Size = UDim2.new(0, 100, 0, 4)
  20. Container.Visible = false
  21.  
  22. UICorner.CornerRadius = UDim.new(1, 0)
  23. UICorner.Parent = Container
  24.  
  25. UIStroke.Parent = Container
  26.  
  27. Health.Name = "Health"
  28. Health.Parent = Container
  29. Health.AnchorPoint = Vector2.new(1, 0)
  30. Health.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
  31. Health.BackgroundTransparency = 0.400
  32. Health.Position = UDim2.new(1, 0, 0, 0)
  33. Health.Size = UDim2.new(0.5, 0, 1, 0)
  34.  
  35. UICorner_2.CornerRadius = UDim.new(1, 0)
  36. UICorner_2.Parent = Health
  37.  
  38. local Players = game:GetService('Players')
  39. local LocalPlayer = Players.LocalPlayer
  40.  
  41. while wait() do
  42. pcall(function()
  43. local Humanoid = LocalPlayer.Character.Humanoid
  44. local Ratio = Humanoid.Health/Humanoid.MaxHealth
  45.  
  46. Container.Visible = Ratio ~= 1
  47.  
  48. Health.Size = UDim2.new(Ratio,0,1,0)
  49. Health.BackgroundColor3 = Color3.fromHSV(Ratio*.3, 1, 1)
  50. end)
  51. end
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement