Advertisement
Guest User

Health GUI

a guest
Mar 31st, 2019
5,979
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. -- [ VARS ]
  2. local players = game:GetService('Players')
  3. local lplayer = players.LocalPlayer
  4. local character = lplayer.Character
  5. local playergui = lplayer.PlayerGui
  6. repeat wait() until playergui:FindFirstChild('timeLeftGui')
  7. local gui = game:GetObjects("rbxassetid://03016520245")[1]
  8. gui.Parent = lplayer.PlayerGui
  9. local tab = gui.Frame.ScrollingFrame.Frame
  10.  
  11. -- [ FUNCTIONS ]
  12. function updateSpell(newtab,player)
  13. wait(1)
  14. newtab.cd1.cdtime.TextColor3 = Color3.fromRGB(255,255,255)
  15. newtab.cd2.cdtime.TextColor3 = Color3.fromRGB(255,255,255)
  16. newtab.cd1.cdtime.BackgroundTransparency = 1
  17. newtab.cd2.cdtime.BackgroundTransparency = 1
  18. for _,spell in pairs(player.Backpack:GetChildren()) do
  19. if spell.abilitySlot.Value == "q" then
  20. newtab.cd1.Image = spell.imageId.Value
  21. spell.cooldown.Changed:connect(function()
  22. newtab.cd1.cdtime.Text = math.floor(spell.cooldown.Value)
  23. if spell.cooldown.Value <= .1 then
  24. newtab.cd1.cdtime.Visible = false
  25. else
  26. newtab.cd1.cdtime.Visible = true
  27. end
  28. end)
  29. elseif spell.abilitySlot.Value == "e" then
  30. newtab.cd2.Image = spell.imageId.Value
  31. spell.cooldown.Changed:connect(function()
  32. newtab.cd2.cdtime.Text = math.floor(spell.cooldown.Value)
  33. if spell.cooldown.Value <= .1 then
  34. newtab.cd2.cdtime.Visible = false
  35. else
  36. newtab.cd2.cdtime.Visible = true
  37. end
  38. end)
  39. end
  40. end
  41. end
  42.  
  43. function updateBar(bar,player)
  44. local msize = 236
  45. local oldColor = Color3.fromRGB(99, 255, 75)
  46. local humanoid = player.Character.Humanoid
  47. local health = player.Character.Humanoid.Health
  48. local max = player.Character.Humanoid.MaxHealth
  49. local max = player.Character.Humanoid.MaxHealth
  50. local percent = (health/max)
  51. local newval = percent*msize
  52. bar.BackgroundColor3 = Color3.fromRGB(245,255,231)
  53. wait(.1)
  54. bar.BackgroundColor3 = oldColor
  55. bar.Size = UDim2.new(0,newval,0,25)
  56. end
  57.  
  58. -- [ INITIAL SETUP ]
  59. playergui.playerStatus.Frame.teammateHolder.Visible = false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement