Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- Part2 = Instance.new("Part")
- CylinderMesh3 = Instance.new("CylinderMesh")
- Smoke4 = Instance.new("Smoke")
- Part5 = Instance.new("Part")
- Script6 = Instance.new("Script")
- ObjectValue7 = Instance.new("ObjectValue")
- Animation8 = Instance.new("Animation")
- ObjectValue9 = Instance.new("ObjectValue")
- LocalScript10 = Instance.new("LocalScript")
- ScreenGui11 = Instance.new("ScreenGui")
- Frame12 = Instance.new("Frame")
- Frame13 = Instance.new("Frame")
- TextLabel14 = Instance.new("TextLabel")
- NumberValue15 = Instance.new("NumberValue")
- Script16 = Instance.new("Script")
- Script17 = Instance.new("Script")
- Script18 = Instance.new("Script")
- Tool19 = Instance.new("Tool")
- Part20 = Instance.new("Part")
- Part21 = Instance.new("Part")
- CylinderMesh22 = Instance.new("CylinderMesh")
- Smoke23 = Instance.new("Smoke")
- Part24 = Instance.new("Part")
- Script25 = Instance.new("Script")
- ObjectValue26 = Instance.new("ObjectValue")
- Animation27 = Instance.new("Animation")
- ObjectValue28 = Instance.new("ObjectValue")
- LocalScript29 = Instance.new("LocalScript")
- ScreenGui30 = Instance.new("ScreenGui")
- Frame31 = Instance.new("Frame")
- Frame32 = Instance.new("Frame")
- TextLabel33 = Instance.new("TextLabel")
- NumberValue34 = Instance.new("NumberValue")
- Script35 = Instance.new("Script")
- Script36 = Instance.new("Script")
- Script37 = Instance.new("Script")
- Tool38 = Instance.new("Tool")
- Part39 = Instance.new("Part")
- Part40 = Instance.new("Part")
- CylinderMesh41 = Instance.new("CylinderMesh")
- Smoke42 = Instance.new("Smoke")
- Part43 = Instance.new("Part")
- Script44 = Instance.new("Script")
- ObjectValue45 = Instance.new("ObjectValue")
- Animation46 = Instance.new("Animation")
- ObjectValue47 = Instance.new("ObjectValue")
- LocalScript48 = Instance.new("LocalScript")
- ScreenGui49 = Instance.new("ScreenGui")
- Frame50 = Instance.new("Frame")
- Frame51 = Instance.new("Frame")
- TextLabel52 = Instance.new("TextLabel")
- NumberValue53 = Instance.new("NumberValue")
- Script54 = Instance.new("Script")
- Script55 = Instance.new("Script")
- Script56 = Instance.new("Script")
- Tool0.Name = "Dig"
- Tool0.Parent = mas
- Part1.Name = "Shaft"
- Part1.Parent = Tool0
- Part1.BrickColor = BrickColor.new("Brown")
- Part1.Transparency = 1
- Part1.Rotation = Vector3.new(90, 0, 180)
- Part1.CanCollide = false
- Part1.Size = Vector3.new(1, 1.20000005, 1)
- Part1.CFrame = CFrame.new(-0.190005645, 3.27113247, -51.3199501, -1, -8.85545069e-06, 2.26416751e-06, -2.26409475e-06, -8.40721441e-06, -1, 8.85547615e-06, -1, 8.40720077e-06)
- Part1.BackSurface = Enum.SurfaceType.Weld
- Part1.BottomSurface = Enum.SurfaceType.Weld
- Part1.FrontSurface = Enum.SurfaceType.Weld
- Part1.LeftSurface = Enum.SurfaceType.Weld
- Part1.RightSurface = Enum.SurfaceType.Weld
- Part1.TopSurface = Enum.SurfaceType.Weld
- Part1.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part1.Position = Vector3.new(-0.190005645, 3.27113247, -51.3199501)
- Part1.Orientation = Vector3.new(90, -180, 0)
- Part1.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part2.Name = "Dirt"
- Part2.Parent = Tool0
- Part2.BrickColor = BrickColor.new("Dark stone grey")
- Part2.Transparency = 1
- Part2.Rotation = Vector3.new(0, -0.0199999996, 180)
- Part2.CanCollide = false
- Part2.Size = Vector3.new(1, 1.20000005, 1)
- Part2.CFrame = CFrame.new(-0.190016598, 6.17117882, -51.3199501, -0.99999994, -2.10918824e-06, -0.000354161253, 2.11217753e-06, -1, -8.70998429e-06, -0.000354160846, -8.71034808e-06, 0.99999994)
- Part2.BackSurface = Enum.SurfaceType.Weld
- Part2.BottomSurface = Enum.SurfaceType.Weld
- Part2.FrontSurface = Enum.SurfaceType.Weld
- Part2.LeftSurface = Enum.SurfaceType.Weld
- Part2.RightSurface = Enum.SurfaceType.Weld
- Part2.TopSurface = Enum.SurfaceType.Weld
- Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part2.Position = Vector3.new(-0.190016598, 6.17117882, -51.3199501)
- Part2.Orientation = Vector3.new(0, -0.0199999996, 180)
- Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
- CylinderMesh3.Parent = Part2
- CylinderMesh3.Scale = Vector3.new(0.400000006, 0.400000006, 0.400000006)
- CylinderMesh3.Scale = Vector3.new(0.400000006, 0.400000006, 0.400000006)
- Smoke4.Parent = Part2
- Smoke4.Size = 0.10000000149012
- Smoke4.Color = Color3.new(0.372549, 0.211765, 0.121569)
- Smoke4.Enabled = false
- Smoke4.Opacity = 0.25
- Smoke4.RiseVelocity = -0.5
- Smoke4.Color = Color3.new(0.372549, 0.211765, 0.121569)
- Part5.Name = "Handle"
- Part5.Parent = Tool0
- Part5.BrickColor = BrickColor.new("Bright green")
- Part5.Transparency = 1
- Part5.Rotation = Vector3.new(0, 90, 0)
- Part5.Size = Vector3.new(1, 1.20000005, 1)
- Part5.CFrame = CFrame.new(-0.190006226, 4.37113285, -51.3199577, -8.85535337e-06, -2.26414318e-06, 1, -8.40711709e-06, 1, 2.26411908e-06, -1, -8.40729808e-06, -8.85557347e-06)
- Part5.Color = Color3.new(0.294118, 0.592157, 0.294118)
- Part5.Position = Vector3.new(-0.190006226, 4.37113285, -51.3199577)
- Part5.Orientation = Vector3.new(0, 90, 0)
- Part5.Color = Color3.new(0.294118, 0.592157, 0.294118)
- Script6.Name = "Weld"
- Script6.Parent = Tool0
- table.insert(cors,sandbox(Script6,function()
- function Weld(x,y)
- local W = Instance.new("Weld")
- W.Part0 = x
- W.Part1 = y
- local CJ = CFrame.new(x.Position)
- local C0 = x.CFrame:inverse()*CJ
- local C1 = y.CFrame:inverse()*CJ
- W.C0 = C0
- W.C1 = C1
- W.Parent = x
- end
- function Get(A)
- if A.className == "Part" then
- Weld(script.Parent.Handle, A)
- A.Anchored = false
- else
- local C = A:GetChildren()
- for i=1, #C do
- Get(C[i])
- end
- end
- end
- function Finale()
- Get(script.Parent)
- end
- script.Parent.Equipped:connect(Finale)
- script.Parent.Unequipped:connect(Finale)
- Finale()
- end))
- ObjectValue7.Name = "DiggyDiggyHole"
- ObjectValue7.Parent = Tool0
- Animation8.Name = "SlashAnim"
- Animation8.Parent = Tool0
- Animation8.AnimationId = "http://www.roblox.com/Asset?ID=54673790"
- ObjectValue9.Name = "guiObject"
- ObjectValue9.Parent = Tool0
- LocalScript10.Name = "Dig"
- LocalScript10.Parent = Tool0
- LocalScript10.Disabled = true
- table.insert(cors,sandbox(LocalScript10,function()
- wait(1)
- enabled = true
- Tool = script.Parent
- down = false -- Mouse isn't down
- gui = script.LoadBar:clone() -- Displays your process in digging
- -- Cyrion's auto-wedge fcn:
- --sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously was
- --returns true if made a wedge, false if the cell remains a block
- function MakeWedge(x, y, z, defaultmaterial)
- local c = game.Workspace.Terrain
- --gather info about all the cells around x, y, z
- surroundings = {} --surroundings is a 3 x 3 x 3 array of the material of the cells adjacent to x, y, z
- for i = x - 1, x + 1 do
- surroundings[i] = {"Water"}
- for j = y - 1, y + 1 do
- surroundings[i][j] = {}
- for k = z - 1, z + 1 do
- local material, wedge, rotation = c:GetCell(i, j, k)
- surroundings[i][j][k] = material.Value
- end
- end
- end
- --make some useful arrays and counters
- local sides = {} --sides is an array of the material of the 4 adjacent sides
- sides[0] = surroundings[x - 1][y][z]
- sides[1] = surroundings[x][y][z + 1]
- sides[2] = surroundings[x + 1][y][z]
- sides[3] = surroundings[x][y][z - 1]
- local adjacentSides = 0
- for n = 0, 3 do
- if sides[n] > 0 then
- adjacentSides = adjacentSides + 1
- end
- end
- local sidesAbove = {} --sides is an array of the material of the 4 adjacent sides 1 height above
- sidesAbove[0] = surroundings[x - 1][y + 1][z]
- sidesAbove[1] = surroundings[x][y + 1][z + 1]
- sidesAbove[2] = surroundings[x + 1][y + 1][z]
- sidesAbove[3] = surroundings[x][y + 1][z - 1]
- local adjacentSidesAbove = 0
- for n = 0, 3 do
- if sidesAbove[n] > 0 then
- adjacentSidesAbove = adjacentSidesAbove + 1
- end
- end
- local corners = {} --corners is an array of the material of the 4 adjacent corners
- corners[0] = surroundings[x - 1][y][z - 1]
- corners[1] = surroundings[x - 1][y][z + 1]
- corners[2] = surroundings[x + 1][y][z + 1]
- corners[3] = surroundings[x + 1][y][z - 1]
- local adjacentCorners = 0
- for n = 0, 3 do
- if corners[n] > 0 then
- adjacentCorners = adjacentCorners + 1
- end
- end
- local cornersAbove = {} --corners is an array of the material of the 4 adjacent corners 1 height above
- cornersAbove[0] = surroundings[x - 1][y + 1][z - 1]
- cornersAbove[1] = surroundings[x - 1][y + 1][z + 1]
- cornersAbove[2] = surroundings[x + 1][y + 1][z + 1]
- cornersAbove[3] = surroundings[x + 1][y + 1][z - 1]
- local adjacentCornersAbove = 0
- for n = 0, 3 do
- if cornersAbove[n] > 0 then
- adjacentCornersAbove = adjacentCornersAbove + 1
- end
- end
- --determine what type of wedge to make
- local material = "Water"
- local wedge = nil
- local rotation = nil
- if defaultmaterial then
- material = defaultmaterial
- else
- material, wedge, rotation = c:GetCell(x, y, z) --start with the existing material, wedge, and rotation
- end
- wedge = 0 --default wedge is a block
- rotation = 0 --default rotation is 0
- --type 1: 45 degree ramp //must not have a block on top and must have a block under, and be surrounded by 1 side; or 3 sides and the 2 corners between them
- if surroundings[x][y + 1][z] == 0 and surroundings[x][y - 1][z] > 0 then
- if adjacentSides == 1 then
- for n = 0, 3 do
- if sides[n] > 0 then
- wedge = 1
- rotation = (n + 1) % 4
- c:SetCell(x, y, z, "Water", "Solid", "Z")
- return true
- end
- end
- elseif adjacentSides == 3 then
- for n = 0, 3 do
- if sides[n] > 0 and corners[(n + 1) % 4] > 0 and sides[(n + 1) % 4] > 0 and corners[(n + 2) % 4] > 0 and sides[(n + 2) % 4] > 0 then
- wedge = 1
- rotation = (n + 2) % 4
- c:SetCell(x, y, z, 0,0,0)
- return true
- end
- end
- end
- end
- --type 2: 45 degree corner //must not have a block on top and must have a block under, and be surrounded by 2 sides and the 1 corner between them; or 3 sides and 1 corner between 2 of them (facing towards that corner)
- if surroundings[x][y + 1][z] == 0 and surroundings[x][y - 1][z] > 0 then
- for n = 0, 3 do
- if sides[n] > 0 and corners[(n + 1) % 4] > 0 and sides[(n + 1) % 4] > 0 and (adjacentSides == 2 or (adjacentSides == 3 and (corners[(n + 3) % 4] > 0 or (sides[(n + 2) % 4] > 0 and corners[(n + 2) % 4] > 0) or (sides[(n + 3) % 4] > 0 and corners[n] > 0)))) then
- wedge = 2
- rotation = (n + 2) % 4
- c:SetCell(x, y, z, 0,0,0)
- return true
- end
- end
- end
- --type 3: 45 degree inverse corner //surrounded by three sides or 4 sides and 3 corners, with nothing above or else a block on top surrounded on 2 sides and the corner between them
- if adjacentSides == 3 and surroundings[x][y + 1][z] > 0 then
- if adjacentCorners > 1 then
- for n = 0, 3 do
- if (corners[n] == 0 or cornersAbove[n] == 0) and (sides[(n - 1) % 4] == 0 or sides[n] == 0) and (sidesAbove[n] == 0 and sidesAbove[(n + 1) % 4] > 0 and sidesAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 3) % 4] == 0) then
- wedge = 3
- rotation = (n + 3) % 4
- c:SetCell(x, y, z, 0,0,0)
- return true
- end
- end
- end
- elseif adjacentSides == 4 and adjacentCorners == 3 then
- for n = 0, 3 do
- if corners[n] == 0 and (surroundings[x][y + 1][z] == 0 or (sidesAbove[n] == 0 and sidesAbove[(n + 1) % 4] > 0 and cornersAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 3) % 4] == 0)) then
- wedge = 3
- rotation = (n + 3) % 4
- c:SetCell(x, y, z, 0,0,0)
- return true
- end
- end
- end
- --type 4: half a cube, as if it were cut diagonally from front to back //surrounded by 2 sides
- if adjacentSides == 2 and adjacentCorners < 4 then
- for n = 0, 3 do
- if sides[n] == 0 and sides[(n + 1) % 4] == 0 and (surroundings[x][y + 1][z] == 0 or (sidesAbove[n] == 0 and sidesAbove[(n + 1) % 4] == 0 and sidesAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 3) % 4] > 0)) then
- wedge = 4
- rotation = n
- c:SetCell(x, y, z, 0,0,0)
- return true
- end
- end
- end
- c:SetCell(x, y, z, 0,0,0)
- return false
- end
- function updateMouseRadius(mouse) -- Makes sure that while the player is digging he doesn't go move his mouse somewhere else going outside our magnitude
- p = game.Players.LocalPlayer
- if (mouse.Hit.p - p.Character.Torso.Position).magnitude > 20 then -- YOU RULE BREAKER!!!
- onDeselect() -- Acts as if they stopped holding the mouse down
- end
- end
- function onClick(mouse)
- h = game.Players.LocalPlayer.Character.Humanoid
- if not enabled or down or h == nil then
- return
- end
- p = game.Players.LocalPlayer
- if (p == nil) then return end
- if (p.Character == nil) then return end
- if (mouse.Hit.p - p.Character.Torso.Position).magnitude > 20 then return end
- down = true
- enabled = false
- c = game.Workspace.Terrain
- while down do
- Tool.Dirt.Smoke.Enabled = true
- if not p.PlayerGui:findFirstChild("LoadBar") then
- local l = gui:clone()
- l.Parent = p.PlayerGui
- script.Parent.guiObject.Value = l
- end
- local guivalue = p.PlayerGui:findFirstChild("LoadBar").Frame.LoadBarPercentage
- updateMouseRadius(mouse) -- Checks radius
- guivalue.Value = guivalue.Value + 30
- if guivalue.Value >= 100 then
- local cellPos = c:WorldToCellPreferSolid(Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z))
- local x = cellPos.x
- local y = cellPos.y
- local z = cellPos.z
- c:SetCell(x, y, z, "Water","Solid",0)
- for i = x - 1, x + 1 do
- for j = y - 1, y + 1 do
- for k = z - 1, z + 1 do
- MakeWedge(i, j, k)
- end
- end
- end
- Tool.Dirt.Smoke.Enabled = false
- onDeselect(mouse) -- Kills GUI
- enabled = false
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- wait(0.5)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- enabled = true
- end
- wait()
- end
- end
- function onClickOff(mouse)
- Tool.Dirt.Smoke.Enabled = false
- enabled = true
- down = false
- if script.Parent.guiObject.Value ~= nil then
- script.Parent.guiObject.Value:remove()
- end
- if Tool.DiggyDiggyHole.Value ~= nil then
- Tool.DiggyDiggyHole.Value:Stop()
- Tool.DiggyDiggyHole.Value:remove()
- end
- Tool.GripForward = Vector3.new(0,0,-1)
- Tool.GripRight = Vector3.new(0,0,0)
- Tool.GripUp = Vector3.new(0, 1, 0)
- Tool.Animate.Disabled = true -- The script seems to crash after digging due to the animation becoming nil. Just restart it.
- Tool.Animate.Disabled = false
- end
- function onDeselect(mouse)
- Tool.Dirt.Smoke.Enabled = false
- enabled = true
- down = false
- if script.Parent.guiObject.Value ~= nil then
- script.Parent.guiObject.Value:remove()
- end
- if Tool.DiggyDiggyHole.Value ~= nil then
- Tool.DiggyDiggyHole.Value:Stop()
- Tool.DiggyDiggyHole.Value:remove()
- end
- Tool.GripForward = Vector3.new(0,0,-1)
- Tool.GripRight = Vector3.new(0,0,0)
- Tool.GripUp = Vector3.new(0, 1, 0)
- Tool.Animate.Disabled = true -- The script seems to crash after digging due to the animation becoming nil. Just restart it.
- Tool.Animate.Disabled = false
- end
- function onSelect(mouse)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- mouse.Button1Down:connect(function () onClick(mouse) end)
- mouse.Button1Up:connect(function () onClickOff(mouse) end)
- end
- script.Parent.Equipped:connect(onSelect)
- script.Parent.UnEquipped:connect(onDeselect)
- end))
- ScreenGui11.Name = "LoadBar"
- ScreenGui11.Parent = LocalScript10
- Frame12.Parent = ScreenGui11
- Frame12.Size = UDim2.new(0.375, 0, 0.125, 0)
- Frame12.Style = Enum.FrameStyle.RobloxRound
- Frame12.Position = UDim2.new(0.625, 0, 0.75, 0)
- Frame12.Visible = false
- Frame13.Name = "LoadBar"
- Frame13.Parent = Frame12
- Frame13.Size = UDim2.new(0, 0, 1, 0)
- Frame13.Style = Enum.FrameStyle.ChatGreen
- TextLabel14.Parent = Frame13
- TextLabel14.Text = ""
- TextLabel14.Position = UDim2.new(0.5, 0, 0.5, 0)
- TextLabel14.Font = Enum.Font.ArialBold
- TextLabel14.FontSize = Enum.FontSize.Size24
- TextLabel14.TextColor3 = Color3.new(0.6, 0.2, 0)
- NumberValue15.Name = "LoadBarPercentage"
- NumberValue15.Parent = Frame12
- Script16.Parent = NumberValue15
- Script16.Disabled = true
- table.insert(cors,sandbox(Script16,function()
- function UpdateBar()
- script.Parent.Parent.LoadBar.Size = UDim2.new((script.Parent.Parent.LoadBarPercentage.Value*.01),0,1,0)
- script.Parent.Parent.LoadBar.TextLabel.Text = script.Parent.Parent.LoadBarPercentage.Value.."%"
- end
- script.Parent.Changed:connect(UpdateBar)
- end))
- Script17.Name = "Debug"
- Script17.Parent = Script16
- table.insert(cors,sandbox(Script17,function()
- -- Online mode is really screwed up :P
- wait(1)
- script.Parent.Disabled = false
- script:remove()
- end))
- Script18.Name = "Debug"
- Script18.Parent = LocalScript10
- table.insert(cors,sandbox(Script18,function()
- -- Online mode is really screwed up :P
- wait(1)
- script.Parent.Disabled = false
- script:remove()
- end))
- Tool19.Name = "Terraform"
- Tool19.Parent = mas
- Part20.Name = "Shaft"
- Part20.Parent = Tool19
- Part20.BrickColor = BrickColor.new("Brown")
- Part20.Transparency = 1
- Part20.Rotation = Vector3.new(90, 0, 180)
- Part20.CanCollide = false
- Part20.Size = Vector3.new(1, 1.20000005, 1)
- Part20.CFrame = CFrame.new(-0.190006599, 3.27113295, -51.3199539, -1, -8.85543432e-06, 2.26416341e-06, -2.26409884e-06, -8.40719804e-06, -1, 8.85549252e-06, -1, 8.40721714e-06)
- Part20.BackSurface = Enum.SurfaceType.Weld
- Part20.BottomSurface = Enum.SurfaceType.Weld
- Part20.FrontSurface = Enum.SurfaceType.Weld
- Part20.LeftSurface = Enum.SurfaceType.Weld
- Part20.RightSurface = Enum.SurfaceType.Weld
- Part20.TopSurface = Enum.SurfaceType.Weld
- Part20.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part20.Position = Vector3.new(-0.190006599, 3.27113295, -51.3199539)
- Part20.Orientation = Vector3.new(90, -180, 0)
- Part20.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part21.Name = "Dirt"
- Part21.Parent = Tool19
- Part21.BrickColor = BrickColor.new("Dark stone grey")
- Part21.Transparency = 1
- Part21.Rotation = Vector3.new(0, -0.0199999996, 180)
- Part21.CanCollide = false
- Part21.Size = Vector3.new(1, 1.20000005, 1)
- Part21.CFrame = CFrame.new(-0.190016598, 6.17117882, -51.3199501, -0.99999994, -2.10918824e-06, -0.000354161253, 2.11217753e-06, -1, -8.70998429e-06, -0.000354160846, -8.71034808e-06, 0.99999994)
- Part21.BackSurface = Enum.SurfaceType.Weld
- Part21.BottomSurface = Enum.SurfaceType.Weld
- Part21.FrontSurface = Enum.SurfaceType.Weld
- Part21.LeftSurface = Enum.SurfaceType.Weld
- Part21.RightSurface = Enum.SurfaceType.Weld
- Part21.TopSurface = Enum.SurfaceType.Weld
- Part21.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part21.Position = Vector3.new(-0.190016598, 6.17117882, -51.3199501)
- Part21.Orientation = Vector3.new(0, -0.0199999996, 180)
- Part21.Color = Color3.new(0.388235, 0.372549, 0.384314)
- CylinderMesh22.Parent = Part21
- CylinderMesh22.Scale = Vector3.new(0.400000006, 0.400000006, 0.400000006)
- CylinderMesh22.Scale = Vector3.new(0.400000006, 0.400000006, 0.400000006)
- Smoke23.Parent = Part21
- Smoke23.Size = 0.10000000149012
- Smoke23.Color = Color3.new(0.372549, 0.211765, 0.121569)
- Smoke23.Enabled = false
- Smoke23.Opacity = 0.25
- Smoke23.RiseVelocity = -0.5
- Smoke23.Color = Color3.new(0.372549, 0.211765, 0.121569)
- Part24.Name = "Handle"
- Part24.Parent = Tool19
- Part24.BrickColor = BrickColor.new("Bright green")
- Part24.Transparency = 1
- Part24.Rotation = Vector3.new(0, 90, 0)
- Part24.Size = Vector3.new(1, 1.20000005, 1)
- Part24.CFrame = CFrame.new(-0.190008134, 4.37113476, -51.3199577, -8.85529607e-06, -2.26412885e-06, 1, -8.40705979e-06, 1, 2.2641334e-06, -1, -8.40735538e-06, -8.85563077e-06)
- Part24.Color = Color3.new(0.294118, 0.592157, 0.294118)
- Part24.Position = Vector3.new(-0.190008134, 4.37113476, -51.3199577)
- Part24.Orientation = Vector3.new(0, 90, 0)
- Part24.Color = Color3.new(0.294118, 0.592157, 0.294118)
- Script25.Name = "Weld"
- Script25.Parent = Tool19
- table.insert(cors,sandbox(Script25,function()
- function Weld(x,y)
- local W = Instance.new("Weld")
- W.Part0 = x
- W.Part1 = y
- local CJ = CFrame.new(x.Position)
- local C0 = x.CFrame:inverse()*CJ
- local C1 = y.CFrame:inverse()*CJ
- W.C0 = C0
- W.C1 = C1
- W.Parent = x
- end
- function Get(A)
- if A.className == "Part" then
- Weld(script.Parent.Handle, A)
- A.Anchored = false
- else
- local C = A:GetChildren()
- for i=1, #C do
- Get(C[i])
- end
- end
- end
- function Finale()
- Get(script.Parent)
- end
- script.Parent.Equipped:connect(Finale)
- script.Parent.Unequipped:connect(Finale)
- Finale()
- end))
- ObjectValue26.Name = "DiggyDiggyHole"
- ObjectValue26.Parent = Tool19
- Animation27.Name = "SlashAnim"
- Animation27.Parent = Tool19
- Animation27.AnimationId = "http://www.roblox.com/Asset?ID=54673790"
- ObjectValue28.Name = "guiObject"
- ObjectValue28.Parent = Tool19
- LocalScript29.Name = "Dig"
- LocalScript29.Parent = Tool19
- LocalScript29.Disabled = true
- table.insert(cors,sandbox(LocalScript29,function()
- wait(1)
- enabled = true
- Tool = script.Parent
- down = false -- Mouse isn't down
- gui = script.LoadBar:clone() -- Displays your process in digging
- -- Cyrion's auto-wedge fcn:
- --sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously was
- --returns true if made a wedge, false if the cell remains a block
- function MakeWedge(x, y, z, defaultmaterial)
- local c = game.Workspace.Terrain
- --gather info about all the cells around x, y, z
- surroundings = {} --surroundings is a 3 x 3 x 3 array of the material of the cells adjacent to x, y, z
- for i = x - 1, x + 1 do
- surroundings[i] = {"Water"}
- for j = y - 1, y + 1 do
- surroundings[i][j] = {}
- for k = z - 1, z + 1 do
- local material, wedge, rotation = c:GetCell(i, j, k)
- surroundings[i][j][k] = material.Value
- end
- end
- end
- --make some useful arrays and counters
- local sides = {} --sides is an array of the material of the 4 adjacent sides
- sides[0] = surroundings[x - 1][y][z]
- sides[1] = surroundings[x][y][z + 1]
- sides[2] = surroundings[x + 1][y][z]
- sides[3] = surroundings[x][y][z - 1]
- local adjacentSides = 0
- for n = 0, 3 do
- if sides[n] > 0 then
- adjacentSides = adjacentSides + 1
- end
- end
- local sidesAbove = {} --sides is an array of the material of the 4 adjacent sides 1 height above
- sidesAbove[0] = surroundings[x - 1][y + 1][z]
- sidesAbove[1] = surroundings[x][y + 1][z + 1]
- sidesAbove[2] = surroundings[x + 1][y + 1][z]
- sidesAbove[3] = surroundings[x][y + 1][z - 1]
- local adjacentSidesAbove = 0
- for n = 0, 3 do
- if sidesAbove[n] > 0 then
- adjacentSidesAbove = adjacentSidesAbove + 1
- end
- end
- local corners = {} --corners is an array of the material of the 4 adjacent corners
- corners[0] = surroundings[x - 1][y][z - 1]
- corners[1] = surroundings[x - 1][y][z + 1]
- corners[2] = surroundings[x + 1][y][z + 1]
- corners[3] = surroundings[x + 1][y][z - 1]
- local adjacentCorners = 0
- for n = 0, 3 do
- if corners[n] > 0 then
- adjacentCorners = adjacentCorners + 1
- end
- end
- local cornersAbove = {} --corners is an array of the material of the 4 adjacent corners 1 height above
- cornersAbove[0] = surroundings[x - 1][y + 1][z - 1]
- cornersAbove[1] = surroundings[x - 1][y + 1][z + 1]
- cornersAbove[2] = surroundings[x + 1][y + 1][z + 1]
- cornersAbove[3] = surroundings[x + 1][y + 1][z - 1]
- local adjacentCornersAbove = 0
- for n = 0, 3 do
- if cornersAbove[n] > 0 then
- adjacentCornersAbove = adjacentCornersAbove + 1
- end
- end
- --determine what type of wedge to make
- local material = "Water"
- local wedge = nil
- local rotation = nil
- if defaultmaterial then
- material = defaultmaterial
- else
- material, wedge, rotation = c:GetCell(x, y, z) --start with the existing material, wedge, and rotation
- end
- wedge = 0 --default wedge is a block
- rotation = 0 --default rotation is 0
- --type 1: 45 degree ramp //must not have a block on top and must have a block under, and be surrounded by 1 side; or 3 sides and the 2 corners between them
- if surroundings[x][y + 1][z] == 0 and surroundings[x][y - 1][z] > 0 then
- if adjacentSides == 1 then
- for n = 0, 3 do
- if sides[n] > 0 then
- wedge = 1
- rotation = (n + 1) % 4
- c:SetCell(x, y, z, "Water", "Solid", "Z")
- return true
- end
- end
- elseif adjacentSides == 3 then
- for n = 0, 3 do
- if sides[n] > 0 and corners[(n + 1) % 4] > 0 and sides[(n + 1) % 4] > 0 and corners[(n + 2) % 4] > 0 and sides[(n + 2) % 4] > 0 then
- wedge = 1
- rotation = (n + 2) % 4
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- end
- --type 2: 45 degree corner //must not have a block on top and must have a block under, and be surrounded by 2 sides and the 1 corner between them; or 3 sides and 1 corner between 2 of them (facing towards that corner)
- if surroundings[x][y + 1][z] == 0 and surroundings[x][y - 1][z] > 0 then
- for n = 0, 3 do
- if sides[n] > 0 and corners[(n + 1) % 4] > 0 and sides[(n + 1) % 4] > 0 and (adjacentSides == 2 or (adjacentSides == 3 and (corners[(n + 3) % 4] > 0 or (sides[(n + 2) % 4] > 0 and corners[(n + 2) % 4] > 0) or (sides[(n + 3) % 4] > 0 and corners[n] > 0)))) then
- wedge = 2
- rotation = (n + 2) % 4
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- --type 3: 45 degree inverse corner //surrounded by three sides or 4 sides and 3 corners, with nothing above or else a block on top surrounded on 2 sides and the corner between them
- if adjacentSides == 3 and surroundings[x][y + 1][z] > 0 then
- if adjacentCorners > 1 then
- for n = 0, 3 do
- if (corners[n] == 0 or cornersAbove[n] == 0) and (sides[(n - 1) % 4] == 0 or sides[n] == 0) and (sidesAbove[n] == 0 and sidesAbove[(n + 1) % 4] > 0 and sidesAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 3) % 4] == 0) then
- wedge = 3
- rotation = (n + 3) % 4
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- elseif adjacentSides == 4 and adjacentCorners == 3 then
- for n = 0, 3 do
- if corners[n] == 0 and (surroundings[x][y + 1][z] == 0 or (sidesAbove[n] == 0 and sidesAbove[(n + 1) % 4] > 0 and cornersAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 3) % 4] == 0)) then
- wedge = 3
- rotation = (n + 3) % 4
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- --type 4: half a cube, as if it were cut diagonally from front to back //surrounded by 2 sides
- if adjacentSides == 2 and adjacentCorners < 4 then
- for n = 0, 3 do
- if sides[n] == 0 and sides[(n + 1) % 4] == 0 and (surroundings[x][y + 1][z] == 0 or (sidesAbove[n] == 0 and sidesAbove[(n + 1) % 4] == 0 and sidesAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 3) % 4] > 0)) then
- wedge = 4
- rotation = n
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- c:SetCell(x, y, z, "Water","Solid","Z")
- wait(1)
- c:SetCell(x, y, z, 0,0,0)
- return false
- end
- function updateMouseRadius(mouse) -- Makes sure that while the player is digging he doesn't go move his mouse somewhere else going outside our magnitude
- p = game.Players.LocalPlayer
- if (mouse.Hit.p - p.Character.Torso.Position).magnitude > 20 then -- YOU RULE BREAKER!!!
- onDeselect() -- Acts as if they stopped holding the mouse down
- end
- end
- function onClick(mouse)
- h = game.Players.LocalPlayer.Character.Humanoid
- if not enabled or down or h == nil then
- return
- end
- p = game.Players.LocalPlayer
- if (p == nil) then return end
- if (p.Character == nil) then return end
- if (mouse.Hit.p - p.Character.Torso.Position).magnitude > 20 then return end
- down = true
- enabled = false
- c = game.Workspace.Terrain
- while down do
- Tool.Dirt.Smoke.Enabled = true
- if not p.PlayerGui:findFirstChild("LoadBar") then
- local l = gui:clone()
- l.Parent = p.PlayerGui
- script.Parent.guiObject.Value = l
- end
- local guivalue = p.PlayerGui:findFirstChild("LoadBar").Frame.LoadBarPercentage
- updateMouseRadius(mouse) -- Checks radius
- guivalue.Value = guivalue.Value + 30
- if guivalue.Value >= 100 then
- local cellPos = c:WorldToCellPreferSolid(Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z))
- local x = cellPos.x
- local y = cellPos.y
- local z = cellPos.z
- c:SetCell(x, y, z, "Water","Solid",0)
- for i = x - 1, x + 1 do
- for j = y - 1, y + 1 do
- for k = z - 1, z + 1 do
- MakeWedge(i, j, k)
- end
- end
- end
- Tool.Dirt.Smoke.Enabled = false
- onDeselect(mouse) -- Kills GUI
- enabled = false
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- wait(0.5)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- enabled = true
- end
- wait()
- end
- end
- function onClickOff(mouse)
- Tool.Dirt.Smoke.Enabled = false
- enabled = true
- down = false
- if script.Parent.guiObject.Value ~= nil then
- script.Parent.guiObject.Value:remove()
- end
- if Tool.DiggyDiggyHole.Value ~= nil then
- Tool.DiggyDiggyHole.Value:Stop()
- Tool.DiggyDiggyHole.Value:remove()
- end
- Tool.GripForward = Vector3.new(0,0,-1)
- Tool.GripRight = Vector3.new(0,0,0)
- Tool.GripUp = Vector3.new(0, 1, 0)
- Tool.Animate.Disabled = true -- The script seems to crash after digging due to the animation becoming nil. Just restart it.
- Tool.Animate.Disabled = false
- end
- function onDeselect(mouse)
- Tool.Dirt.Smoke.Enabled = false
- enabled = true
- down = false
- if script.Parent.guiObject.Value ~= nil then
- script.Parent.guiObject.Value:remove()
- end
- if Tool.DiggyDiggyHole.Value ~= nil then
- Tool.DiggyDiggyHole.Value:Stop()
- Tool.DiggyDiggyHole.Value:remove()
- end
- Tool.GripForward = Vector3.new(0,0,-1)
- Tool.GripRight = Vector3.new(0,0,0)
- Tool.GripUp = Vector3.new(0, 1, 0)
- Tool.Animate.Disabled = true -- The script seems to crash after digging due to the animation becoming nil. Just restart it.
- Tool.Animate.Disabled = false
- end
- function onSelect(mouse)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- mouse.Button1Down:connect(function () onClick(mouse) end)
- mouse.Button1Up:connect(function () onClickOff(mouse) end)
- end
- script.Parent.Equipped:connect(onSelect)
- script.Parent.UnEquipped:connect(onDeselect)
- end))
- ScreenGui30.Name = "LoadBar"
- ScreenGui30.Parent = LocalScript29
- Frame31.Parent = ScreenGui30
- Frame31.Size = UDim2.new(0.375, 0, 0.125, 0)
- Frame31.Style = Enum.FrameStyle.RobloxRound
- Frame31.Position = UDim2.new(0.625, 0, 0.75, 0)
- Frame31.Visible = false
- Frame32.Name = "LoadBar"
- Frame32.Parent = Frame31
- Frame32.Size = UDim2.new(0, 0, 1, 0)
- Frame32.Style = Enum.FrameStyle.ChatGreen
- TextLabel33.Parent = Frame32
- TextLabel33.Text = ""
- TextLabel33.Position = UDim2.new(0.5, 0, 0.5, 0)
- TextLabel33.Font = Enum.Font.ArialBold
- TextLabel33.FontSize = Enum.FontSize.Size24
- TextLabel33.TextColor3 = Color3.new(0.6, 0.2, 0)
- NumberValue34.Name = "LoadBarPercentage"
- NumberValue34.Parent = Frame31
- Script35.Parent = NumberValue34
- Script35.Disabled = true
- table.insert(cors,sandbox(Script35,function()
- function UpdateBar()
- script.Parent.Parent.LoadBar.Size = UDim2.new((script.Parent.Parent.LoadBarPercentage.Value*.01),0,1,0)
- script.Parent.Parent.LoadBar.TextLabel.Text = script.Parent.Parent.LoadBarPercentage.Value.."%"
- end
- script.Parent.Changed:connect(UpdateBar)
- end))
- Script36.Name = "Debug"
- Script36.Parent = Script35
- table.insert(cors,sandbox(Script36,function()
- -- Online mode is really screwed up :P
- wait(1)
- script.Parent.Disabled = false
- script:remove()
- end))
- Script37.Name = "Debug"
- Script37.Parent = LocalScript29
- table.insert(cors,sandbox(Script37,function()
- -- Online mode is really screwed up :P
- wait(1)
- script.Parent.Disabled = false
- script:remove()
- end))
- Tool38.Name = "Water"
- Tool38.Parent = mas
- Part39.Name = "Shaft"
- Part39.Parent = Tool38
- Part39.BrickColor = BrickColor.new("Brown")
- Part39.Transparency = 1
- Part39.Rotation = Vector3.new(90, 0, 180)
- Part39.CanCollide = false
- Part39.Size = Vector3.new(1, 1.20000005, 1)
- Part39.CFrame = CFrame.new(-0.190005645, 3.27113247, -51.3199539, -1, -8.85535792e-06, 2.26414431e-06, -2.26411794e-06, -8.40712164e-06, -1, 8.85556892e-06, -1, 8.40729354e-06)
- Part39.BackSurface = Enum.SurfaceType.Weld
- Part39.BottomSurface = Enum.SurfaceType.Weld
- Part39.FrontSurface = Enum.SurfaceType.Weld
- Part39.LeftSurface = Enum.SurfaceType.Weld
- Part39.RightSurface = Enum.SurfaceType.Weld
- Part39.TopSurface = Enum.SurfaceType.Weld
- Part39.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part39.Position = Vector3.new(-0.190005645, 3.27113247, -51.3199539)
- Part39.Orientation = Vector3.new(90, -180, 0)
- Part39.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part40.Name = "Dirt"
- Part40.Parent = Tool38
- Part40.BrickColor = BrickColor.new("Dark stone grey")
- Part40.Transparency = 1
- Part40.Rotation = Vector3.new(0, -0.0199999996, 180)
- Part40.CanCollide = false
- Part40.Size = Vector3.new(1, 1.20000005, 1)
- Part40.CFrame = CFrame.new(-0.190016598, 6.17117882, -51.3199501, -0.99999994, -2.10918824e-06, -0.000354161253, 2.11217753e-06, -1, -8.70998429e-06, -0.000354160846, -8.71034808e-06, 0.99999994)
- Part40.BackSurface = Enum.SurfaceType.Weld
- Part40.BottomSurface = Enum.SurfaceType.Weld
- Part40.FrontSurface = Enum.SurfaceType.Weld
- Part40.LeftSurface = Enum.SurfaceType.Weld
- Part40.RightSurface = Enum.SurfaceType.Weld
- Part40.TopSurface = Enum.SurfaceType.Weld
- Part40.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part40.Position = Vector3.new(-0.190016598, 6.17117882, -51.3199501)
- Part40.Orientation = Vector3.new(0, -0.0199999996, 180)
- Part40.Color = Color3.new(0.388235, 0.372549, 0.384314)
- CylinderMesh41.Parent = Part40
- CylinderMesh41.Scale = Vector3.new(0.400000006, 0.400000006, 0.400000006)
- CylinderMesh41.Scale = Vector3.new(0.400000006, 0.400000006, 0.400000006)
- Smoke42.Parent = Part40
- Smoke42.Size = 0.10000000149012
- Smoke42.Color = Color3.new(0.372549, 0.211765, 0.121569)
- Smoke42.Enabled = false
- Smoke42.Opacity = 0.25
- Smoke42.RiseVelocity = -0.5
- Smoke42.Color = Color3.new(0.372549, 0.211765, 0.121569)
- Part43.Name = "Handle"
- Part43.Parent = Tool38
- Part43.BrickColor = BrickColor.new("Bright green")
- Part43.Transparency = 1
- Part43.Rotation = Vector3.new(0, 90, 0)
- Part43.Size = Vector3.new(1, 1.20000005, 1)
- Part43.CFrame = CFrame.new(-0.190010995, 4.37113523, -51.3199654, -8.85545342e-06, -2.26416819e-06, 1, -8.40721714e-06, 1, 2.26409406e-06, -1, -8.40719804e-06, -8.85547342e-06)
- Part43.Color = Color3.new(0.294118, 0.592157, 0.294118)
- Part43.Position = Vector3.new(-0.190010995, 4.37113523, -51.3199654)
- Part43.Orientation = Vector3.new(0, 90, 0)
- Part43.Color = Color3.new(0.294118, 0.592157, 0.294118)
- Script44.Name = "Weld"
- Script44.Parent = Tool38
- table.insert(cors,sandbox(Script44,function()
- function Weld(x,y)
- local W = Instance.new("Weld")
- W.Part0 = x
- W.Part1 = y
- local CJ = CFrame.new(x.Position)
- local C0 = x.CFrame:inverse()*CJ
- local C1 = y.CFrame:inverse()*CJ
- W.C0 = C0
- W.C1 = C1
- W.Parent = x
- end
- function Get(A)
- if A.className == "Part" then
- Weld(script.Parent.Handle, A)
- A.Anchored = false
- else
- local C = A:GetChildren()
- for i=1, #C do
- Get(C[i])
- end
- end
- end
- function Finale()
- Get(script.Parent)
- end
- script.Parent.Equipped:connect(Finale)
- script.Parent.Unequipped:connect(Finale)
- Finale()
- end))
- ObjectValue45.Name = "DiggyDiggyHole"
- ObjectValue45.Parent = Tool38
- Animation46.Name = "SlashAnim"
- Animation46.Parent = Tool38
- Animation46.AnimationId = "http://www.roblox.com/Asset?ID=54673790"
- ObjectValue47.Name = "guiObject"
- ObjectValue47.Parent = Tool38
- LocalScript48.Name = "Dig"
- LocalScript48.Parent = Tool38
- LocalScript48.Disabled = true
- table.insert(cors,sandbox(LocalScript48,function()
- wait(1)
- enabled = true
- Tool = script.Parent
- down = false -- Mouse isn't down
- gui = script.LoadBar:clone() -- Displays your process in digging
- -- Cyrion's auto-wedge fcn:
- --sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously was
- --returns true if made a wedge, false if the cell remains a block
- function MakeWedge(x, y, z, defaultmaterial)
- local c = game.Workspace.Terrain
- --gather info about all the cells around x, y, z
- surroundings = {} --surroundings is a 3 x 3 x 3 array of the material of the cells adjacent to x, y, z
- for i = x - 1, x + 1 do
- surroundings[i] = {"Water"}
- for j = y - 1, y + 1 do
- surroundings[i][j] = {}
- for k = z - 1, z + 1 do
- local material, wedge, rotation = c:GetCell(i, j, k)
- surroundings[i][j][k] = material.Value
- end
- end
- end
- --make some useful arrays and counters
- local sides = {} --sides is an array of the material of the 4 adjacent sides
- sides[0] = surroundings[x - 1][y][z]
- sides[1] = surroundings[x][y][z + 1]
- sides[2] = surroundings[x + 1][y][z]
- sides[3] = surroundings[x][y][z - 1]
- local adjacentSides = 0
- for n = 0, 3 do
- if sides[n] > 0 then
- adjacentSides = adjacentSides + 1
- end
- end
- local sidesAbove = {} --sides is an array of the material of the 4 adjacent sides 1 height above
- sidesAbove[0] = surroundings[x - 1][y + 1][z]
- sidesAbove[1] = surroundings[x][y + 1][z + 1]
- sidesAbove[2] = surroundings[x + 1][y + 1][z]
- sidesAbove[3] = surroundings[x][y + 1][z - 1]
- local adjacentSidesAbove = 0
- for n = 0, 3 do
- if sidesAbove[n] > 0 then
- adjacentSidesAbove = adjacentSidesAbove + 1
- end
- end
- local corners = {} --corners is an array of the material of the 4 adjacent corners
- corners[0] = surroundings[x - 1][y][z - 1]
- corners[1] = surroundings[x - 1][y][z + 1]
- corners[2] = surroundings[x + 1][y][z + 1]
- corners[3] = surroundings[x + 1][y][z - 1]
- local adjacentCorners = 0
- for n = 0, 3 do
- if corners[n] > 0 then
- adjacentCorners = adjacentCorners + 1
- end
- end
- local cornersAbove = {} --corners is an array of the material of the 4 adjacent corners 1 height above
- cornersAbove[0] = surroundings[x - 1][y + 1][z - 1]
- cornersAbove[1] = surroundings[x - 1][y + 1][z + 1]
- cornersAbove[2] = surroundings[x + 1][y + 1][z + 1]
- cornersAbove[3] = surroundings[x + 1][y + 1][z - 1]
- local adjacentCornersAbove = 0
- for n = 0, 3 do
- if cornersAbove[n] > 0 then
- adjacentCornersAbove = adjacentCornersAbove + 1
- end
- end
- --determine what type of wedge to make
- local material = "Water"
- local wedge = nil
- local rotation = nil
- if defaultmaterial then
- material = defaultmaterial
- else
- material, wedge, rotation = c:GetCell(x, y, z) --start with the existing material, wedge, and rotation
- end
- wedge = 0 --default wedge is a block
- rotation = 0 --default rotation is 0
- --type 1: 45 degree ramp //must not have a block on top and must have a block under, and be surrounded by 1 side; or 3 sides and the 2 corners between them
- if surroundings[x][y + 1][z] == 0 and surroundings[x][y - 1][z] > 0 then
- if adjacentSides == 1 then
- for n = 0, 3 do
- if sides[n] > 0 then
- wedge = 1
- rotation = (n + 1) % 4
- c:SetCell(x, y, z, "Water", "Solid", "Z")
- return true
- end
- end
- elseif adjacentSides == 3 then
- for n = 0, 3 do
- if sides[n] > 0 and corners[(n + 1) % 4] > 0 and sides[(n + 1) % 4] > 0 and corners[(n + 2) % 4] > 0 and sides[(n + 2) % 4] > 0 then
- wedge = 1
- rotation = (n + 2) % 4
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- end
- --type 2: 45 degree corner //must not have a block on top and must have a block under, and be surrounded by 2 sides and the 1 corner between them; or 3 sides and 1 corner between 2 of them (facing towards that corner)
- if surroundings[x][y + 1][z] == 0 and surroundings[x][y - 1][z] > 0 then
- for n = 0, 3 do
- if sides[n] > 0 and corners[(n + 1) % 4] > 0 and sides[(n + 1) % 4] > 0 and (adjacentSides == 2 or (adjacentSides == 3 and (corners[(n + 3) % 4] > 0 or (sides[(n + 2) % 4] > 0 and corners[(n + 2) % 4] > 0) or (sides[(n + 3) % 4] > 0 and corners[n] > 0)))) then
- wedge = 2
- rotation = (n + 2) % 4
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- --type 3: 45 degree inverse corner //surrounded by three sides or 4 sides and 3 corners, with nothing above or else a block on top surrounded on 2 sides and the corner between them
- if adjacentSides == 3 and surroundings[x][y + 1][z] > 0 then
- if adjacentCorners > 1 then
- for n = 0, 3 do
- if (corners[n] == 0 or cornersAbove[n] == 0) and (sides[(n - 1) % 4] == 0 or sides[n] == 0) and (sidesAbove[n] == 0 and sidesAbove[(n + 1) % 4] > 0 and sidesAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 3) % 4] == 0) then
- wedge = 3
- rotation = (n + 3) % 4
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- elseif adjacentSides == 4 and adjacentCorners == 3 then
- for n = 0, 3 do
- if corners[n] == 0 and (surroundings[x][y + 1][z] == 0 or (sidesAbove[n] == 0 and sidesAbove[(n + 1) % 4] > 0 and cornersAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 3) % 4] == 0)) then
- wedge = 3
- rotation = (n + 3) % 4
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- --type 4: half a cube, as if it were cut diagonally from front to back //surrounded by 2 sides
- if adjacentSides == 2 and adjacentCorners < 4 then
- for n = 0, 3 do
- if sides[n] == 0 and sides[(n + 1) % 4] == 0 and (surroundings[x][y + 1][z] == 0 or (sidesAbove[n] == 0 and sidesAbove[(n + 1) % 4] == 0 and sidesAbove[(n + 2) % 4] > 0 and sidesAbove[(n + 3) % 4] > 0)) then
- wedge = 4
- rotation = n
- c:SetCell(x, y, z, "Water","Solid","Z")
- return true
- end
- end
- end
- c:SetCell(x, y, z, "Water","Solid","Z")
- return false
- end
- function updateMouseRadius(mouse) -- Makes sure that while the player is digging he doesn't go move his mouse somewhere else going outside our magnitude
- p = game.Players.LocalPlayer
- if (mouse.Hit.p - p.Character.Torso.Position).magnitude > 20 then -- YOU RULE BREAKER!!!
- onDeselect() -- Acts as if they stopped holding the mouse down
- end
- end
- function onClick(mouse)
- h = game.Players.LocalPlayer.Character.Humanoid
- if not enabled or down or h == nil then
- return
- end
- p = game.Players.LocalPlayer
- if (p == nil) then return end
- if (p.Character == nil) then return end
- if (mouse.Hit.p - p.Character.Torso.Position).magnitude > 20 then return end
- down = true
- enabled = false
- c = game.Workspace.Terrain
- while down do
- Tool.Dirt.Smoke.Enabled = true
- if not p.PlayerGui:findFirstChild("LoadBar") then
- local l = gui:clone()
- l.Parent = p.PlayerGui
- script.Parent.guiObject.Value = l
- end
- local guivalue = p.PlayerGui:findFirstChild("LoadBar").Frame.LoadBarPercentage
- updateMouseRadius(mouse) -- Checks radius
- guivalue.Value = guivalue.Value + 30
- if guivalue.Value >= 100 then
- local cellPos = c:WorldToCellPreferSolid(Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z))
- local x = cellPos.x
- local y = cellPos.y
- local z = cellPos.z
- c:SetCell(x, y, z, "Water","Solid",0)
- for i = x - 1, x + 1 do
- for j = y - 1, y + 1 do
- for k = z - 1, z + 1 do
- MakeWedge(i, j, k)
- end
- end
- end
- Tool.Dirt.Smoke.Enabled = false
- onDeselect(mouse) -- Kills GUI
- enabled = false
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- wait(0.5)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- enabled = true
- end
- wait()
- end
- end
- function onClickOff(mouse)
- Tool.Dirt.Smoke.Enabled = false
- enabled = true
- down = false
- if script.Parent.guiObject.Value ~= nil then
- script.Parent.guiObject.Value:remove()
- end
- if Tool.DiggyDiggyHole.Value ~= nil then
- Tool.DiggyDiggyHole.Value:Stop()
- Tool.DiggyDiggyHole.Value:remove()
- end
- Tool.GripForward = Vector3.new(0,0,-1)
- Tool.GripRight = Vector3.new(0,0,0)
- Tool.GripUp = Vector3.new(0, 1, 0)
- Tool.Animate.Disabled = true -- The script seems to crash after digging due to the animation becoming nil. Just restart it.
- Tool.Animate.Disabled = false
- end
- function onDeselect(mouse)
- Tool.Dirt.Smoke.Enabled = false
- enabled = true
- down = false
- if script.Parent.guiObject.Value ~= nil then
- script.Parent.guiObject.Value:remove()
- end
- if Tool.DiggyDiggyHole.Value ~= nil then
- Tool.DiggyDiggyHole.Value:Stop()
- Tool.DiggyDiggyHole.Value:remove()
- end
- Tool.GripForward = Vector3.new(0,0,-1)
- Tool.GripRight = Vector3.new(0,0,0)
- Tool.GripUp = Vector3.new(0, 1, 0)
- Tool.Animate.Disabled = true -- The script seems to crash after digging due to the animation becoming nil. Just restart it.
- Tool.Animate.Disabled = false
- end
- function onSelect(mouse)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- mouse.Button1Down:connect(function () onClick(mouse) end)
- mouse.Button1Up:connect(function () onClickOff(mouse) end)
- end
- script.Parent.Equipped:connect(onSelect)
- script.Parent.UnEquipped:connect(onDeselect)
- end))
- ScreenGui49.Name = "LoadBar"
- ScreenGui49.Parent = LocalScript48
- Frame50.Parent = ScreenGui49
- Frame50.Size = UDim2.new(0.375, 0, 0.125, 0)
- Frame50.Style = Enum.FrameStyle.RobloxRound
- Frame50.Position = UDim2.new(0.625, 0, 0.75, 0)
- Frame50.Visible = false
- Frame51.Name = "LoadBar"
- Frame51.Parent = Frame50
- Frame51.Size = UDim2.new(0, 0, 1, 0)
- Frame51.Style = Enum.FrameStyle.ChatGreen
- TextLabel52.Parent = Frame51
- TextLabel52.Text = ""
- TextLabel52.Position = UDim2.new(0.5, 0, 0.5, 0)
- TextLabel52.Font = Enum.Font.ArialBold
- TextLabel52.FontSize = Enum.FontSize.Size24
- TextLabel52.TextColor3 = Color3.new(0.6, 0.2, 0)
- NumberValue53.Name = "LoadBarPercentage"
- NumberValue53.Parent = Frame50
- Script54.Parent = NumberValue53
- Script54.Disabled = true
- table.insert(cors,sandbox(Script54,function()
- function UpdateBar()
- script.Parent.Parent.LoadBar.Size = UDim2.new((script.Parent.Parent.LoadBarPercentage.Value*.01),0,1,0)
- script.Parent.Parent.LoadBar.TextLabel.Text = script.Parent.Parent.LoadBarPercentage.Value.."%"
- end
- script.Parent.Changed:connect(UpdateBar)
- end))
- Script55.Name = "Debug"
- Script55.Parent = Script54
- table.insert(cors,sandbox(Script55,function()
- -- Online mode is really screwed up :P
- wait(1)
- script.Parent.Disabled = false
- script:remove()
- end))
- Script56.Name = "Debug"
- Script56.Parent = LocalScript48
- table.insert(cors,sandbox(Script56,function()
- -- Online mode is really screwed up :P
- wait(1)
- script.Parent.Disabled = false
- script:remove()
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement