Advertisement
HenloMyDude

sandbag from super smash bros

Sep 10th, 2019
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1.  
  2.  
  3. mesh = "rbxassetid://1990230124"
  4. texture = "rbxassetid://1990230137"
  5. face = "http://www.roblox.com/asset/?id=25766289"
  6. scale = 0.35
  7. dmg = 0
  8. max = 5000000
  9. health = 999
  10. high = false
  11. meghigh = false
  12.  
  13. local plr = owner
  14. local char = plr.Character
  15. --local root = char.HumanoidRootPart
  16. local root = char.Torso
  17. local sandbag = Instance.new("SpecialMesh",root)
  18. sandbag.MeshId = mesh
  19. sandbag.TextureId = texture
  20. sandbag.Scale = Vector3.new(scale, scale, scale)
  21.  
  22. for _,v in pairs (char:children()) do
  23. if v:IsA("Part") then
  24. v.Transparency = 1
  25. end
  26. if v:IsA("Accessory") or v:IsA("Hat") then
  27. v:Destroy()
  28. end
  29. end
  30.  
  31. local h = char.Humanoid
  32. h.MaxHealth = health
  33. h.Health = health
  34. h.Animator:Destroy()
  35. local hp = h.Health
  36. Debris = game:GetService("Debris")
  37.  
  38. function swait(num)
  39. if num == 0 or num == nil then
  40. game:service("RunService").Stepped:wait(0)
  41. else
  42. for i = 0, num do
  43. game:service("RunService").Stepped:wait(0)
  44. end
  45. end
  46. end
  47.  
  48. ezweld = function(p, a, b, cf)
  49. local weld = Instance.new("Weld",p)
  50. weld.Part0 = a
  51. weld.Part1 = b
  52. weld.C0 = cf
  53. return weld
  54. end
  55.  
  56. local rootj = ezweld(root, root, char.HumanoidRootPart, CFrame.new())
  57.  
  58. local sur = Instance.new("BillboardGui", char.Head)
  59. sur.Name = "Billboard"
  60. sur.Adornee = char.Head
  61. sur.Size = UDim2.new(10, 0, 5, 0)
  62. sur.StudsOffset = Vector3.new(0, 3.5, 0)
  63. local text = Instance.new("TextBox", sur)
  64. text.Text = dmg .."%"
  65. text.Size = UDim2.new(1, 0, 1, 0)
  66. text.TextScaled = true
  67. text.BackgroundTransparency = 1
  68. text.Font = Enum.Font.SourceSansLight
  69. text.TextColor3 = Color3.new(1, 1, 1)
  70. text.TextStrokeTransparency = 0
  71.  
  72. NewSound = function(p, id, pit, vol, loop)
  73. local Sound = Instance.new("Sound",p)
  74. Sound.Pitch = pit
  75. Sound.Volume = vol
  76. Sound.SoundId = "rbxassetid://" ..id
  77. Sound.Looped = loop
  78. Sound:Play()
  79. return Sound
  80. end
  81.  
  82. function HealthChanged()
  83. if h.Health < hp then
  84. if h.Health > 0 then
  85. dmg = dmg + 5
  86. if dmg < 50 and high == false and meghigh == false then
  87. NewSound(root, 260430060, 1, 10, false)
  88. end
  89. if dmg > 49 and high == true and meghigh == false then
  90. NewSound(root, 260430079, 1, 10, false)
  91. end
  92. if dmg > 99 and high == true and meghigh == true then
  93. NewSound(root, 260430117, 1, 10, false)
  94. end
  95. for i = 1,dmg / 2 do
  96. swait()
  97. rootj.C0 = rootj.C0 * CFrame.Angles(dmg / 7, 0 ,0)
  98. root.Anchored = true
  99. root.CFrame = root.CFrame * CFrame.new(0, 0.35 * dmg / 5, 0.35)
  100. end
  101. rootj.C0 = CFrame.new()
  102. root.Anchored = false
  103. end
  104. end
  105. hp = h.Health
  106. end
  107.  
  108. h.HealthChanged:Connect(HealthChanged)
  109.  
  110. function reset()
  111. dmg = 0
  112. text.TextColor3 = Color3.new(1, 1, 1)
  113. end
  114.  
  115. plr.Chatted:connect(function(msg)
  116. if msg == "!reset" then
  117. reset()
  118. end
  119. if msg:sub(1, 4) == "!dmg" then
  120. dmg = dmg + msg:sub(6)
  121. end
  122. end)
  123.  
  124. spawn(function()
  125. swait()
  126. root.Transparency = 0
  127. sandbag.MeshId = mesh
  128. sandbag.TextureId = texture
  129. sandbag.Scale = Vector3.new(scale, scale, scale)
  130. --decal.Texture = face
  131. --decal.Face = "Top"
  132. end)
  133.  
  134. while true do
  135. swait()
  136. text.Text = dmg .."%"
  137. if dmg > 49 and high == false and meghigh == false then
  138. high = true
  139. meghigh = false
  140. text.TextColor3 = BrickColor.new("Neon orange").Color
  141. end
  142. if dmg > 99 and high == true and meghigh == false then
  143. high = false
  144. meghigh = true
  145. text.TextColor3 = BrickColor.new("Really red").Color
  146. end
  147. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement