If i use this script it works fine for 1 "tree" but if i want to copy and paste the tree multiple times on the map it does not work anymore. The script is placed inside the tree, how do i get it so the script only works within that model?
local click = script.Parent:WaitForChild("ClickDetector")
click.MouseClick:Connect (function(player)
for _,v in pairs (game.Workspace.SmallTree1.Leaves:GetChildren()) do
if v:IsA("Part") then--Checks if the Child that is inside the Model is ClassName Part.
v.Anchored = false
end
end
for _,v in pairs (game.Workspace.SmallTree1.Logs:GetChildren()) do
if v:IsA("Part") then--Checks if the Child that is inside the Model is ClassName Part.
v.Anchored = false
end
end
end)

2 comments
the problem is you already "tell the script" that it needs to take "SmallTree1", which might not be the current tree, I suggest using script.Parent..Parent..... to actually get the parent tree of the script (btw, for copying, I'd recommend to use modules/a script that copies code from the serverstorage, so you can edit it more easily (and not have to change 20 scripts when you see a bug or want to
Okay, Thanks for helping!