Need help with local script

local tool = script.Parent
local CrackingTheTreePart = Instance.new("Part")
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 = 50

tool.Equipped:Connect(function()

mainrangefromtrees = 50
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

if mouse.Target == b then

if firstattack == false then

CrackingTheTreePart.Size = Vector3.new(TreeAttackSizePlus+.1,.2,1.4)
end
if firstattack == true then

CrackingTheTreePart.Parent = workspace
CrackingTheTreePart.Anchored = true
CrackingTheTreePart.CFrame = b.CFrame * CFrame.new(0,2,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)

Problem: When i click tree this script works:

  •   if firstattack == true then
      CrackingTheTreePart.Parent = workspace
      CrackingTheTreePart.Anchored = true
      CrackingTheTreePart.CFrame = b.CFrame * CFrame.new(0,2,0)
      CrackingTheTreePart.Size = Vector3.new(.1, .2, 1.4)
      firstattack = false
      end
    

and second click:

  •     if firstattack == false then
      CrackingTheTreePart.Size = Vector3.new(TreeAttackSizePlus+.1,.2,1.4)
      end
    

and when third click nothing

The formatting’s a bit messed up, can you revise it?

It’s not that the third click is doing nothing, it just doesn’t change the size because the size is already set to what it would be if clicked.

I made it easier to understand, I hope I helped.

So how should I change that code? can you please do ?

well, what exactly are to trying to do for the size each time? Adding to the size?

First Size is 0.1, 0.2, 1.4 and final size is 1.5, 0.2, 1.4 Enough ?

Well, I would change this line to these lines:

if CrackingTheTreePart.Size < Vector3.new(1.5, 0.2, 1.4) then
CrackingTheTreePart.Size += Vector3.new(TreeAtackSizePlus, 0, 0)
end