Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local degrees = {
- CFrame.Angles(math.rad(45),math.rad(0),math.rad(0)),
- CFrame.Angles(math.rad(45),math.rad(45),math.rad(0)),
- CFrame.Angles(math.rad(0),math.rad(0),math.rad(45)),
- CFrame.Angles(math.rad(45),math.rad(0),math.rad(45)),
- CFrame.Angles(math.rad(45),math.rad(45),math.rad(0)),
- CFrame.Angles(math.rad(0),math.rad(45),math.rad(45)),
- CFrame.Angles(math.rad(45),math.rad(45),math.rad(45)),
- }
- local blacklisted = {
- 'Base',
- 'Baseplate',
- }
- function make_crater(size,cf,mode)
- local subtract = {}
- if mode == 1 then
- for i = 1,#degrees do
- local p = Instance.new("Part")
- p.Size = Vector3.new(size,size,size)
- p.Shape = Enum.PartType.Block
- p.Anchored = true
- p.CanCollide = false
- p.Transparency = 0.5
- local angle = degrees[i]
- angle = math.random()
- p.CFrame = cf*angle
- p.Parent = game.Lighting
- table.insert(subtract,1,p)
- end
- elseif mode == 2 then
- for i = 1,1 do
- local p = Instance.new("Part")
- p.Size = Vector3.new(size,size,size)
- p.Shape = Enum.PartType.Ball
- p.Anchored = true
- p.CanCollide = false
- p.Transparency = 0.5
- p.CFrame = cf
- p.Parent = game.Lighting
- table.insert(subtract,1,p)
- end
- elseif mode == 3 then
- for i = 1,10 do
- local p = Instance.new("Part")
- p.Size = Vector3.new(size,size,size)
- p.Shape = Enum.PartType.Block
- p.Anchored = true
- p.CanCollide = false
- p.Transparency = 0.5
- local angle = CFrame.Angles(math.rad(math.random()*180),math.rad(math.random()*180),math.rad(math.random()*180))
- p.CFrame = cf*angle
- p.Parent = game.Lighting
- table.insert(subtract,1,p)
- end
- end
- assert(#subtract > 0,'No parts to union.')
- local region = Region3.new(cf.p-Vector3.new(size,size,size)/2,cf.p+Vector3.new(size,size,size)/2)
- local parts = workspace:FindPartsInRegion3WithIgnoreList(region,subtract,1/0)
- for _,v in ipairs(parts) do
- if v and v:IsA("BasePart") and not v.Parent:IsA("Accessory") and not v.Parent:FindFirstChildOfClass("Humanoid") and not table.find(blacklisted,v.Name) then
- coroutine.wrap(function()
- local par = v.Parent
- v.Parent = game:GetService("Lighting")
- local union
- local success = pcall(function()
- union = v:SubtractAsync(subtract,Enum.CollisionFidelity.PreciseConvexDecomposition,Enum.RenderFidelity.Precise)
- end)
- if not union or not success then
- v:Destroy()
- return
- end
- union.Name = v.Name
- union.Anchored = v.Anchored
- union.CanCollide = v.CanCollide
- for _,vv in pairs(v:GetChildren()) do
- vv.Parent = union
- end
- v:Destroy()
- union.Parent = par
- end)()
- end
- end
- for i,v in ipairs(subtract) do v:Destroy() end
- end
- local plr = owner
- local pgui = plr:FindFirstChildOfClass("PlayerGui")
- local remote = Instance.new("RemoteEvent")
- remote.Parent = pgui
- remote.OnServerEvent:Connect(function(lplr,cf,radius)
- if lplr == plr then else return end
- make_crater(radius,cf,3)
- end)
- warn([[
- == Made by KrYn0MoRe ==
- == KEYS ==
- e = radius 5
- r = radius 10
- t = radius 15
- y = radius 20
- ]])
- NLS([[
- local remote = script.Parent
- local plr = game:GetService("Players").LocalPlayer
- local mouse = plr:GetMouse()
- mouse.KeyDown:Connect(function(key)
- if key == 'e' then
- remote:FireServer(mouse.Hit,5)
- elseif key == 'r' then
- remote:FireServer(mouse.Hit,10)
- elseif key == 't' then
- remote:FireServer(mouse.Hit,15)
- elseif key == 'y' then
- remote:FireServer(mouse.Hit,20)
- end
- end)
- ]],remote)
Add Comment
Please, Sign In to add comment