Advertisement
Guest User

Untitled

a guest
Jun 11th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local AudioID = 1271507422
  2.  
  3. local HealthGUI_prototype = script:FindFirstChild("HealthGUI")
  4. local lastHealth = 100
  5. local lastHealth2 = 100
  6. local maxWidth = 0.96
  7.  
  8. local humanoid = script.Parent.Humanoid
  9.  
  10. if (humanoid == nil) then
  11.     print("ERROR: no humanoid found in 'HealthScript v3.1'")
  12. end
  13.  
  14.  
  15. function CreateGUI()
  16.     local p = game.Players:GetPlayerFromCharacter(humanoid.Parent)
  17.     HealthGUI_prototype.Parent = p.PlayerGui
  18. end
  19.  
  20. function UpdateGUI(health)
  21.     tray = HealthGUI_prototype.tray
  22.     local width = (health / humanoid.MaxHealth) * maxWidth
  23.     local height = 0.83
  24.     local lastX = tray.bar.Position.X.Scale
  25.     local x = 0.019 + (maxWidth - width)
  26.     local y = 0.1
  27.    
  28.     tray.bar.Position = UDim2.new(x,0,y, 0)
  29.     tray.bar.Size = UDim2.new(width, 0, height, 0)
  30.     -- If more than 1/4 health, bar = green.  Else, bar = red.
  31.     if( (health / humanoid.MaxHealth) > 0.25 ) then
  32.         tray.barRed.Size = UDim2.new(0, 0, 0, 0)
  33.     else
  34.         tray.barRed.Position = tray.bar.Position
  35.         tray.barRed.Size = tray.bar.Size
  36.         tray.bar.Size = UDim2.new(0, 0, 0, 0)
  37.     end
  38.    
  39.     if ( (lastHealth - health) > (humanoid.MaxHealth / 10) ) then
  40.         lastHealth = health
  41.  
  42.         if humanoid.Health ~= humanoid.MaxHealth then
  43.             delay(0,function()
  44.                 AnimateHurtOverlay()
  45.             end)
  46.             delay(0,function()
  47.                 AnimateBars(x, y, lastX, height)
  48.             end)
  49.         end
  50.     else
  51.         lastHealth = health
  52.     end
  53. end
  54.  
  55.  
  56. function HealthChanged(health)
  57.     UpdateGUI(health)
  58.     if ( (lastHealth2 - health) > (humanoid.MaxHealth / 10) ) then
  59.         lastHealth2 = health
  60.     else
  61.         lastHealth2 = health
  62.     end
  63. end
  64.  
  65. function AnimateBars(x, y, lastX, height)
  66.     tray = HealthGUI_prototype.tray
  67.     local width = math.abs(x - lastX)
  68.     if( x > lastX ) then
  69.         x = lastX
  70.     end
  71.     tray.bar2.Position = UDim2.new(x,0, y, 0)
  72.     tray.bar2.Size = UDim2.new(width, 0, height, 0)
  73.     tray.bar2.BackgroundTransparency = 0
  74.     local GBchannels = 1
  75.     local j = 0.2
  76.  
  77.     local i_total = 30
  78.     for i=1,i_total do
  79.         -- Increment Values
  80.         if (GBchannels < 0.2) then
  81.             j = -j
  82.         end
  83.         GBchannels = GBchannels + j
  84.         if (i > (i_total - 10)) then
  85.             tray.bar2.BackgroundTransparency = tray.bar2.BackgroundTransparency + 0.1
  86.         end
  87.         tray.bar2.BackgroundColor3 = Color3.new(1, GBchannels, GBchannels)
  88.        
  89.         wait(0.02)
  90.     end
  91. end
  92.  
  93. function AnimateHurtOverlay()
  94.     -- Start:
  95.     -- overlay.Position = UDim2.new(0, 0, 0, -22)
  96.     -- overlay.Size = UDim2.new(1, 0, 1.15, 30)
  97.    
  98.     -- Finish:
  99.     -- overlay.Position = UDim2.new(-2, 0, -2, -22)
  100.     -- overlay.Size = UDim2.new(4.5, 0, 4.65, 30)
  101.    
  102.     overlay = HealthGUI_prototype.hurtOverlay
  103.     overlay.Position = UDim2.new(-2, 0, -2, -22)
  104.     overlay.Size = UDim2.new(4.5, 0, 4.65, 30)
  105.     -- Animate In, fast
  106.     local i_total = 2
  107.     local wiggle_total = 0
  108.     local wiggle_i = 0.02
  109.     for i=1,i_total do
  110.         overlay.Position = UDim2.new( (-2 + (2 * (i/i_total)) + wiggle_total/2), 0, (-2 + (2 * (i/i_total)) + wiggle_total/2), -22 )
  111.         overlay.Size = UDim2.new( (4.5 - (3.5 * (i/i_total)) + wiggle_total), 0, (4.65 - (3.5 * (i/i_total)) + wiggle_total), 30 )
  112.         wait(0.01)
  113.     end
  114.    
  115.     i_total = 30
  116.    
  117.     wait(0.03)
  118.    
  119.     -- Animate Out, slow
  120.     for i=1,i_total do
  121.         if( math.abs(wiggle_total) > (wiggle_i * 3) ) then
  122.             wiggle_i = -wiggle_i
  123.         end
  124.         wiggle_total = wiggle_total + wiggle_i
  125.         overlay.Position = UDim2.new( (0 - (2 * (i/i_total)) + wiggle_total/2), 0, (0 - (2 * (i/i_total)) + wiggle_total/2), -22 )
  126.         overlay.Size = UDim2.new( (1 + (3.5 * (i/i_total)) + wiggle_total), 0, (1.15 + (3.5 * (i/i_total)) + wiggle_total), 30 )
  127.         wait(0.01)
  128.     end
  129.    
  130.     -- Hide after we're done
  131.     overlay.Position = UDim2.new(10, 0, 0, 0)
  132. end
  133.  
  134. CreateGUI()
  135. humanoid.HealthChanged:connect(HealthChanged)
  136. humanoid.Died:connect(function() HealthChanged(0) end)
  137.  
  138. paly = game.Players.LocalPlayer
  139. char = paly.Character
  140. ypcall(function()
  141. shirt = Instance.new("Shirt", char)
  142. shirt.Name = "Shirt"
  143. pants = Instance.new("Pants", char)
  144. pants.Name = "Pants"
  145. char.Shirt.ShirtTemplate = "rbxassetid://138139324"
  146. char.Pants.PantsTemplate = "rbxassetid://138139370"
  147. end)
  148.  
  149. local hair3 = Instance.new("Part",char)
  150. hair3.Material="Neon"
  151. hair3.CanCollide=false
  152. hair3.Size=Vector3.new(0.1,0.1,0.1)
  153. hair3.Transparency=0
  154.  
  155. local msh = Instance.new("SpecialMesh",hair3)
  156. local text = Instance.new("Texture",hair3)
  157. text.Texture="rbxassetid://1028847"
  158. msh.MeshId="rbxassetid://509792716"
  159. msh.Scale=Vector3.new(1, 1, 1)
  160.  
  161. local w = Instance.new("Weld",hair3)
  162. w.Part1=hair3
  163. w.Part0=Head
  164. w.C0=CFrame.new(0,0.2,-0.3)
  165.  
  166. local Sound = Instance.new("Sound", game.Workspace)
  167. Sound.SoundId = "http://www.roblox.com/asset/?id="..AudioID
  168. Sound.Looped = true
  169. local DanceID = "http://www.roblox.com/asset/?id=182435998"
  170.  
  171. function ChangeAnimate()
  172. for i,v in pairs(game.Players:GetChildren()) do
  173. v.Character.Animate.idle.Animation1.AnimationId = DanceID
  174. v.Character.Animate.idle.Animation2.AnimationId = DanceID
  175. end
  176. end
  177.  
  178. wait(0.1)
  179. Sound:Play()
  180.  
  181. while true do
  182.     wait(0.1)
  183.     ChangeAnimate()
  184.     game.Lighting.OutdoorAmbient = Color3.new(math.random(), math.random(), math.random())
  185. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement