I was trying to make a tree generator for a thing, But it failed as normal. This is the issue: I want to make branches on top of the TopSurface. What i mean by that is that i want branches on top of the top surface of the part. This would make a infinite line, But it does not. I cannot explain this and i need YOUR help.

--local redBlock = game.Workspace.Wood1
--local blueCube = game.Workspace.Wood2
-- 
--local offsetCFrame = CFrame.new(0,-0.5, 0)
--redBlock.CFrame = blueCube.CFrame:ToWorldSpace(offsetCFrame)
local branchLength = 3
local thickNess = 1
local thickNessDecrease = 0.1
local rotateFactor = 1

local bNumber = 0

local StartingWood = Instance.new("Part",script.Parent)
StartingWood.Name = "StartingWood"
StartingWood.Size = Vector3.new(thickNess,branchLength,thickNess)
StartingWood.Position = script.Parent.Startingpoint.Position + Vector3.new(0,StartingWood.Size.Y/2,0)
StartingWood.TopSurface = Enum.SurfaceType.SmoothNoOutlines
StartingWood.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
StartingWood.Material = Enum.Material.Wood
StartingWood.Anchored = true

function makeBranch(sW)
	bNumber = bNumber + 1
	thickNess = thickNess - thickNessDecrease
	local Wood = Instance.new("Part",script.Parent)
	Wood.Name = "Wood"..bNumber
	Wood.Size = Vector3.new(thickNess,branchLength,thickNess)
	Wood.TopSurface = Enum.SurfaceType.SmoothNoOutlines
	Wood.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
	Wood.Material = Enum.Material.Wood
	Wood.Anchored = true
	
	local startingWood2 = sW
    local finishingWood

	local offsetCFrame = CFrame.new(0,Wood.Size.Y/2, 0)
	Wood.CFrame = sW.CFrame:ToWorldSpace(offsetCFrame)
end

makeBranch(StartingWood)

while wait(1) do
	makeBranch(script.Parent["Wood"..bNumber])
	print("Wood"..bNumber)
end

REMEMBER: No errors in output and, MAKE A GOOD ANSWER! Tell me why, How to prevent this kind of stuff happening, AND FIRST LOOKING AT THE QUESTION!!!

2 comments

0

Its because I believe vector3's cant work with cframe try changing it to cframe.

0

Still does not work