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

Script continue after part changed?

Asked by 6 years ago
Edited 6 years ago

How would I make the part of this script so it does not continue if the the mouse.Target has changed?

function mine()
    mousedown = true
    while mousedown == true do
    local n = script.Parent.Multiplier.Value
    local block = mouse.Target
    wait()
        if block:FindFirstChild("Owner") then
            local DestroyDecal = game.ReplicatedStorage.Destroy0:Clone()
            DestroyDecal.Parent = block
            while mouse.Target == block and mousedown == true do
                mouse.Button1Up:connect(function()
                    mousedown = false
                    DestroyDecal:Destroy()
                end)

Answer this question