I found this dig script which digs terrain. How would I edit the code so that it digs parts which are a certain material and aren't terrain basically a part which is a sand material. For example, make a part transparency = 1 and can collide = false so the part is removed fully.
mouse = game.Players.LocalPlayer:GetMouse() down = false mouse.Button1Down:connect(function () down = true mouse.Button1Up:connect(function () down = false end) local recordedPosition = game.Workspace.Terrain:WorldToCellPreferSolid(mouse.Hit.p) local gui = script.Dig:clone() gui.Parent = game.Players.LocalPlayer.PlayerGui for i = 1,33 do if game.Workspace.Terrain:WorldToCellPreferSolid(mouse.Hit.p) ~= recordedPosition then gui:Destroy() return end if down == false then gui:Destroy() return end gui.Progress.Bar.Size = UDim2.new(0.03*i,0,1,0) wait() end gui:Destroy() game.Workspace.Terrain:SetCell(recordedPosition.X,recordedPosition.Y,recordedPosition.Z,0,0,0) end)
Thank You and Help is appreciated
Note: This script is meant for a tool.
script.Parent.Activated:Connect(function(mouse) if mouse.Hit.Name == "Sand" then -- Just change the if to make it go with your system step = .1 waitC = .1 for i=0,1 step do mouse.Hit.Transparency = i wait(waitC) end mouse.Hit.CanCollide = false end end)