I'm trying to make the tree's leaves unancored when it chopped down. but leaves stays where it is. Is there something wrong with my for i,v in pairs loop?
Note: Wood is the part that i clicked. Tree Model structure: https://imgur.com/5yxO95I
if Cursor.Target ~= nil and Cursor.Target.Parent.Name == 'Tree' and Gather == true then
local Wood = Cursor.Target
if (Wood.Position - Char.HumanoidRootPart.Position).magnitude <10 then
Gather = false
RG = Player.PlayerGui.Gathering
RG.BG.Visible = true
Char.Humanoid.WalkSpeed = 0
ShowProgress('Tree')
Char.Humanoid.WalkSpeed = 16
for i,v in pairs(Wood.Parent.Leaves:GetChildren()) do
if v:IsA('Part') then
v.Anchored = false
end
end
Wood:Destroy()
--Drop Wood
RG.BG.Visible = false
Gather = true
end
end

5 comments
Provide an image of the explorer, please. (Of the tree leaves' children.)
Uh, are this is the full script, or there any errors?
I don't think it's the loop. It could be the magnitude condition not passing.
its only the error part
I added tree model structure's photo as well