Need help with local script

local tool = script.Parent

local player = game.Players

local plr = player.LocalPlayer

local mouse = plr:GetMouse()

local firstattack = true

local AxeDamage = tool:WaitForChild("AxeDetails").AxeDamage

local TreeAttackSizePlus = 1 / AxeDamage.Value

local mainrangefromtrees = 5

tool.Equipped:Connect(function()

mainrangefromtrees = 5

mouse.Button1Down:Connect(function()

local Area1Trees = game.Workspace.Area1Trees.NormalTree

coroutine.wrap(function()

for a,b in pairs(Area1Trees:GetChildren()) do

local distarea1tree = b

if mainrangefromtrees > (distarea1tree.Position - tool.Handle.Position).magnitude then

local CrackingTheTreePart = Instance.new("Part")

if mouse.Target == b then

if firstattack == false then

if CrackingTheTreePart.Size.X < 1.6 then

CrackingTheTreePart.Size = CrackingTheTreePart.Size + Vector3.new(TreeAttackSizePlus,0,0)

end

if CrackingTheTreePart.Size.X > 1.6 then

firstattack = true

CrackingTheTreePart:Destroy()

end

end

if firstattack == true then

CrackingTheTreePart.Parent = workspace

CrackingTheTreePart.Anchored = true

CrackingTheTreePart.Size = Vector3.new(.1, 0.2, 1.4)

CrackingTheTreePart.CFrame = b.CFrame * CFrame.new(0,-mouse.Hit.Position.Y/mouse.Hit.Position.Y,0)

CrackingTheTreePart.Size = Vector3.new(.1, .2, 1.4)

firstattack = false

end

end

end

end

end)()

end)

end)

tool.Unequipped:Connect(function()

mainrangefromtrees = 0

end)

Error: Players.Dquvo.Backpack.StarterAxe.LocalScript:13: The Parent property of Part is locked, current parent: NULL, new parent Workspace

What was the line that gives the error?

Also if you wanted to access the part after deleting it, just do:

CrackingTheTreePart.Parent = nil

:Destroy() is a function that sets an object’s parent to nil and locks the parent (it means you can’t access it after deleting it, matches the error, right?)

I’m pretty sure it should be end) only (I think)