hits = script.Parent.hit --This keeps track of how much "hp" the tree has left
local newtree = script.Parent:clone() --for inserting a new tree later
while true do --infinite loop
if hits.Value < 1 then --if the tree has less than 1 "hp" then
script.Parent:BreakJoints() --make tree able to fall over.
wait(3) --wait a while
script.Parent:remove() --remove the tree
wait(10) --wait a while
newtree.Parent = game.Workspace --insert a new tree
newtree:MakeJoints() --make tree unable to fall over
end
wait(1) --wait a while before checking trees hp again
end
So in this model, I have a model that has a tree, and this script inside of the model. When I first use an axe to hit the tree, it breaks and give me money. After that, it regenerates, but when it regenerates it gives me this line. Workspace.Tree.FellCheck:6: attempt to index field 'Parent' (a nil value)
How do I make it so that there is a parent?

1 comment
Have you tried to play it solo and look at the hierarchy in explorer as this regenerates? I believe you may just be cloning a part, not the whole model?