Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

whats wrong with my pickaxe ?

Asked by 10 years ago

Help, Why this pickaxe not work, it say = [brick] 10% then the pickaxe not work, i use hopper bin, this the script

wait(2)
print("Dig tool loaded")
enabled = true
exists = false
tool = script.Parent
_pos = game.Workspace["Pos"]
player = tool.Parent.Parent
gui = player:findFirstChild("PlayerGui"):findFirstChild("MineGui").Txt
deb = game.Lighting.Debris
delete_script = tool.Dig["Delete"]
error_color = script.Parent["Error"]
msg = false
digging = false
maxdist = 35


function award(plyr, type)
print("awarded!")
local numbricks = game.Players:findFirstChild(plyr).leaderstats["Bricks Dug"]
numbricks.Value = numbricks.Value + 1
local value = game.Players:findFirstChild(plyr)[type]
local maxval = game.Players:findFirstChild(plyr)["MaxAmnt"]
if value.Value < maxval.Value then
value.Value = value.Value + 1
else
value.Value = value.Value + 0
end
end


function probability(part)
part.Dug.Value = false

num = math.random(1,95)
print(num)
if num >= 1 and num <= 70 then
part.BrickColor = BrickColor.new(192)
part.Material = 816
part.Type.Value = "brick"
elseif num > 70 and num <= 77 then
part.BrickColor = BrickColor.new(1014)
part.Material = 1072
part.Type.Value = "brick"
elseif num > 77 and num <= 83 then
part.BrickColor = BrickColor.new(194)
part.Material = 1072
part.Type.Value = "brick"
elseif num > 83 and num <= 87 then
part.BrickColor = BrickColor.new(37)
part.Material = 1536
part.Type.Value = "brick"
elseif num > 87 and num <= 91 then
part.BrickColor = BrickColor.new(21)
part.Material = 1536
part.Type.Value = "brick"
elseif num > 91 and num <= 93 then
part.BrickColor = BrickColor.new(23)
part.Material = 1536
part.Type.Value = "brick"
elseif num > 93 and num <= 95 then
part.BrickColor = BrickColor.new(24)
part.Material = 1072
part.Type.Value = "brick"
end
end


function debris(type, part)
print(type)
if type == "brick" then
for i = 1, 3 do
local deb_clone = deb:clone()
local del_clone = delete_script:clone()
deb_clone.Parent = game.Workspace
deb_clone.CFrame = part.CFrame
deb.Velocity = Vector3.new(math.random(-10,10),0,math.random(-10,10))
del_clone.Parent = deb_clone
del_clone.Disabled = false
end
else
print("Cannot clone")
end
end


function create(part, pos)
x = part.Position.x
y = part.Position.y
z = part.Position.z
partclone = part:clone()
print("Cloned")
partclone.Name = x + pos.x .. ", " .. y + pos.y .. ", " .. z + pos.z
local check = game.Workspace.Mine:findFirstChild(partclone.Name)
local check2 = _pos:findFirstChild(partclone.Name)
local check3 = _pos:findFirstChild(part.Position.x .. ", " .. part.Position.y .. ", " .. part.Position.z)
if not check and not check2 and pos.y + y <= 8000 then
print("Check 1")
local dug_pos = Instance.new("StringValue")
dug_pos.Parent = _pos
dug_pos.Name = part.Position.x .. ", " .. part.Position.y .. ", " .. part.Position.z
if check3 then dug_pos:remove() end
probability(partclone)
partclone.Parent = game.Workspace.Mine
partclone.CFrame = CFrame.new(pos.x + x, pos.y + y, pos.z + z)
print("Part Loaded")
else
partclone:remove()
print("Deleted")
end
end


function dig(part)
if not enabled then return end
enabled = false
award(player.Name, part.Type.Value)
create(part, Vector3.new(0,-8,0))
create(part, Vector3.new(0,8,0))
create(part, Vector3.new(-8,0,0))
create(part, Vector3.new(8,0,0))
create(part, Vector3.new(0,0,-8))
create(part, Vector3.new(0,0,8))
debris(part.Type.Value, part)
part:remove()
enabled = true
end


function MouseClick(mouse)
    print("Clicked")
    if digging then return end
    if mouse.Target ~= nil then
    obj = mouse.Target
    dist = (player.Character.Torso.Position - obj.Position).magnitude
    if obj ~= nil and obj.Parent == game.Workspace.Mine and obj:findFirstChild("Dug") and not obj.Dug.Value and not msg then
        if dist > maxdist then
        msg = true
        gui.TextColor3 = error_color.Value
        gui.BorderColor3 = error_color.Value
        gui.Text = "You are too far away! Get closer!"
        wait(2)
        msg = false
        gui.Text = ""
        elseif dist <= maxdist then
        print("Met requirements")
        msg = true
        digging = true
        obj.Dug.Value = true
        gui.TextColor3 = obj.BrickColor.Color
        gui.BorderColor3 = obj.BrickColor.Color
            for i = 1,10 do
            gui.Text = "Mining " .. obj.Type.Value .. "   " .. tostring(i*10) .. "%"
            wait(player.MineToolLvl.Value / 10)
            end
        gui.TextColor3 = Color3.new(0,0,0)
        gui.BorderColor3 = Color3.new(0,0,0)
        gui.Text = ""
        msg = false
        dig(obj)
        digging = false
        end
        end
    end
end


function MouseMoved(targ)
if msg then return end
if targ and targ:findFirstChild("Type") then
gui.Text = targ.Type.Value
gui.TextColor3 = targ.BrickColor.Color
gui.BorderColor3 = targ.BrickColor.Color
elseif not targ or not targ:findFirstChild("Type") then
gui.Text = ""
gui.TextColor3 = Color3.new(0,0,0)
gui.BorderColor3 = Color3.new(0,0,0)
end
end


function Selected(mouse)
    gui.Visible = true
    mouse.Button1Down:connect(function() MouseClick(mouse) end)
    mouse.Move:connect(function() MouseMoved(mouse.Target) end)
end


function Deselected(mouse)
    gui.Visible = false
end


tool.Selected:connect(Selected)
tool.Deselected:connect(Deselected)

please help me

1 answer

Log in to vote
0
Answered by
parkderp1 105
10 years ago

You only called 3 of the functions.

Ad

Answer this question