Hello, my current tree growing script (shown below) makes all the children of the Model (all of the tree's parts, like branches, etc) grow as well.
I have also made an inner part of the tree for decoration.
I have succeeded at the growing bit so far, however, I have no idea how to make them scale/position correctly so that branches grow off the tree and not into it.
I have tried the Weld tool
, but it doesn't seem to work.
In other words, my problem is:
The branches grow into each other, and I only want them to grow off each other.
Here is a GIF of the issueAs you can probably see, it grows into a mess.
Here is my script (it is a child of the tree model):
local Max = 100 -- Max Size of tree local Speed = 1 -- Speed of which it grows while wait(Speed * 2) do for name, TreePart in pairs(script.Parent:GetChildren()) do if TreePart:IsA("Part") then -- Checking if it's a part -- Finds tree Parts to make them grow print("Found "..TreePart.Name) if TreePart.Name == "Branch" or "InnerPart" then local Tree = TreePart local X = Tree.Size.X + (Speed/10) local Y = Tree.Size.Y + Speed -- The amount tree grows local Z = Tree.Size.Z + (Speed/10) if Y < Max then -- Grow tree if hasn't rached max size Tree.Size = Vector3.new(X,Y,Z) if TreePart.Name == "Branch" or "InnerPart" then local X2 = Tree.Position.X + (Speed/10) -- ERROR IS HERE local Y2 = Tree.Position.Y + Speed/2 -- ERROR IS HERE local Z2 = Tree.Position.Z + (Speed/10) -- ERROR IS HERE Tree.Position = Vector3.new(X2, Y2, Z2) -- ERROR IS HERE else print("Not growing anymore") end end end end end end
Does anyone know how I could correctly position the branches? Thank you. ????
I have fixed it! I just had to make all of the Tree Parts into a Union. Had to edit the script a bit, but it works!