Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetRecursiveChildren(Place)
- local Stuff = {}
- function GRC(P)
- for i,v in pairs(P:GetChildren()) do
- ypcall(function()
- GRC(v)
- table.insert(Stuff,v)
- end)
- end
- end
- GRC(Place)
- GRC = nil
- return Stuff
- end
- Mouse = game.Players.LocalPlayer:GetMouse()
- function Fracture(Spot)
- local Pts = {}
- local AllPts = {}
- local Parts = {}
- local Rays = {}
- local Found = true
- local WPts = GetRecursiveChildren(Workspace)
- Workspace.DescendantAdded:connect(function(v)
- wait()
- if not v:IsDescendantOf(game.Players.LocalPlayer.Character) and v.Name ~= "Base" then
- local F = true
- for i,g in pairs(game.Players:GetPlayers()) do
- if v:IsDescendantOf(g.Character) then
- F = false
- end
- end
- if F then
- table.insert(WPts,v)
- end
- end
- end)
- table.insert(Pts,Spot)
- repeat wait(0.5)
- --print("one")
- wait(0.1)
- local F = false
- -- print("loop start")
- wait(0.1)
- local PTS2 = {}
- for i,v in pairs(WPts) do
- if not v:IsDescendantOf(Workspace) then
- table.remove(WPts,i)
- end
- end
- for i,v in pairs(Pts) do
- wait()
- --print("Searching " ..tostring(v))
- for _,g in pairs(WPts) do
- local PF = false
- for c,d in pairs(Parts) do
- if d == g then
- PF = true
- end
- end
- for z,t in pairs(game.Players:GetPlayers()) do
- if g:IsDescendantOf(t.Character) then
- PF = true
- end
- end
- if g.Name == "Base" then
- PF = true
- end
- if not g:IsDescendantOf(game.Players.LocalPlayer.Character) and not PF then
- ypcall(function()
- if (v-g.Position).magnitude < 20 and g.Name ~= "Base" then
- F = true
- table.insert(PTS2,g.Position)
- table.insert(AllPts,g.Position)
- table.insert(Parts,g)
- g.Anchored = true
- local Ray = Instance.new("Part",game.Players.LocalPlayer.Character)
- Ray.Anchored = true
- local Dis = (v-g.Position).magnitude
- Ray.FormFactor = "Custom"
- Ray.Size = Vector3.new(0.5,0.5,Dis)
- Ray.CanCollide = false
- Ray.CFrame = CFrame.new(v,g.Position)*CFrame.new(0,0,-Dis/2)
- Ray.TopSurface = "Smooth"
- Ray.BottomSurface = "Smooth"
- Ray.BrickColor = BrickColor.new("Black")
- table.insert(Rays,Ray)
- end
- end)
- end
- end
- end
- Pts = PTS2
- print("loop end")
- if not F then
- Found = false
- end
- until not Found
- for i,v in pairs(Rays) do
- v:Destroy()
- end
- for i,v in pairs(Parts) do
- if v.Name ~= "Base" then
- v.Anchored = false
- v:breakJoints()
- end
- end
- for i,v in pairs(AllPts) do
- local a = Instance.new("Explosion",Workspace)
- a.Position = v
- a.BlastRadius = 20
- a.DestroyJointRadiusPercent = 0
- end
- end
- game.Players.LocalPlayer:GetMouse().Button1Down:connect(function()
- Fracture(Mouse.Hit.p)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement