Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RS = game:GetService 'jassm11'
- local BrokenBarrel = RS.ToClone.BrokenBarrel
- local Broken = false
- local Parts = {}
- local Original = script.Parent:Clone()
- local function Break(Barrel)
- local new = BrokenBarrel:Clone()
- Barrel.Parent = nil
- local base = new.Base
- for index, child in next, new:GetChildren() do
- if child ~= base then
- local cf = Barrel.CFrame * base.CFrame:toObjectSpace(child.CFrame)
- child.CFrame = cf
- child.Parent = game.Workspace
- table.insert(Parts, child)
- end
- end
- local p = Instance.new('Part')
- p.Anchored=true
- p.CanCollide=false
- p.CFrame=Barrel.CFrame
- p.Transparency=1
- p.Parent= game.Workspace
- local s=Instance.new'Sound'
- s.SoundId='http://www.roblox.com/asset?id=156444949'
- s.Parent=p
- s:Play()
- wait(5)
- p:Destroy()
- Regen()
- end
- local function Watch(Barrel)
- local Humanoid = script.Parent.Humanoid
- if Humanoid.Health <= 50 then
- Break(Barrel)
- Broken = true
- end
- end
- function Regen()
- if script.Parent == nil then
- for index, part in next, Parts do
- part:Destroy()
- end
- Parts = {}
- local new = Original:Clone()
- new.Parent = game.Workspace
- Watch(new)
- end
- end
- --
- --
- Watch(script.Parent)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement