Advertisement
Guest User

Roblox Health Bar GUI script - ThePumpkinPresident

a guest
Dec 31st, 2021
3,342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. while wait() do
  2.     -- Variables
  3.    
  4.     local base = script.Parent
  5.     local scale = base.Scale
  6.     local text = base.TextLabel
  7.    
  8.     local player = game.Players.LocalPlayer
  9.     local character = player.Character
  10.     local humanoid = character.Humanoid
  11.     local health = humanoid.Health
  12.     local maxHealth = humanoid.MaxHealth
  13.    
  14.     -- Code
  15.    
  16.     local ratio = health / maxHealth
  17.    
  18.     scale.Size = UDim2.new(ratio,0,1,0)
  19.    
  20.     text.Text = math.floor(health)
  21.    
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement