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)