Advertisement
jassm11

Untitled

Jul 4th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local RS = game:GetService 'jassm11'
  2. local BrokenBarrel = RS.ToClone.BrokenBarrel
  3. local Broken = false
  4. local Parts = {}
  5. local Original = script.Parent:Clone()
  6.  
  7. local function Break(Barrel)
  8. local new = BrokenBarrel:Clone()
  9. Barrel.Parent = nil
  10.  
  11. local base = new.Base
  12. for index, child in next, new:GetChildren() do
  13. if child ~= base then
  14. local cf = Barrel.CFrame * base.CFrame:toObjectSpace(child.CFrame)
  15. child.CFrame = cf
  16. child.Parent = game.Workspace
  17. table.insert(Parts, child)
  18. end
  19. end
  20.  
  21. local p = Instance.new('Part')
  22. p.Anchored=true
  23. p.CanCollide=false
  24. p.CFrame=Barrel.CFrame
  25. p.Transparency=1
  26. p.Parent= game.Workspace
  27. local s=Instance.new'Sound'
  28. s.SoundId='http://www.roblox.com/asset?id=156444949'
  29. s.Parent=p
  30. s:Play()
  31.  
  32. wait(5)
  33.  
  34. p:Destroy()
  35. Regen()
  36. end
  37.  
  38. local function Watch(Barrel)
  39. local Humanoid = script.Parent.Humanoid
  40. if Humanoid.Health <= 50 then
  41. Break(Barrel)
  42. Broken = true
  43. end
  44. end
  45.  
  46. function Regen()
  47. if script.Parent == nil then
  48. for index, part in next, Parts do
  49. part:Destroy()
  50. end
  51. Parts = {}
  52.  
  53. local new = Original:Clone()
  54. new.Parent = game.Workspace
  55. Watch(new)
  56. end
  57. end
  58.  
  59. --
  60. --
  61. Watch(script.Parent)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement