Evolution tree help

To simulate evolution treee

  1. What is the issue? Include screenshots / videos if possible!
    one of Root start connecting all of them with Beam
local RootSpecie = workspace.RootSpecie
local SpecieNumber = 0
local Year = 50
local Yearmini = 10
for i = 1,4 do
	local Specie =  RootSpecie:Clone()
	local attachment1 = Instance.new("Attachment",Specie)
	local Attachment2 = Instance.new("Attachment",RootSpecie)
	local beam = Instance.new("Beam",Specie)
	-- getting ready
	Specie.BrickColor = BrickColor.random()
	Specie.Parent = workspace["Evolution Tree"]
	Specie.Position = Specie.Position + Vector3.new(
		math.random(-30, 30),
		math.random(Yearmini, Year),
		math.random(Yearmini, Year)
	)
	Specie.ParentSpecie.Value = RootSpecie.Name
    beam.FaceCamera = true
	beam.Attachment0 = attachment1
	beam.Attachment1 = Attachment2
	beam.Color = ColorSequence.new({
		ColorSequenceKeypoint.new(0,Specie.Color),
		ColorSequenceKeypoint.new(1,RootSpecie.Color)
		
	})
	
end

	for _, SpecieI in pairs(workspace["Evolution Tree"]:GetChildren()) do
	for i = 1,10 do
		local Specie =  SpecieI:Clone()
		local attachment1 = Instance.new("Attachment",Specie)
		local Attachment2 = Instance.new("Attachment",SpecieI)
		local beam = Instance.new("Beam",Specie)
		-- getting ready
		Specie.BrickColor = BrickColor.random()
		Specie.Parent = workspace["Evolution Tree"]
		Specie.Position = Specie.Position + Vector3.new(
			math.random(-30, 30),
			math.random(Yearmini, Year),
			math.random(Yearmini, Year)
		)
		Specie.ParentSpecie.Value = SpecieI.Name
		beam.FaceCamera = true
		beam.Attachment0 = attachment1
		beam.Attachment1 = Attachment2
		beam.Color = ColorSequence.new({
			ColorSequenceKeypoint.new(0,Specie.Color),
			ColorSequenceKeypoint.new(1,SpecieI.Color)

		})
	end
	end


most of beams white are connceted to them even it aren’t supposes,

i want like this thing

You are creating the colored clones from workspace[‘Evolution Tree’], and you parent the first branching species (that link to the RootSpecie) to workspace[‘Evolution Tree’], which leads to the colored clones keeping that link to the RootSpecie. Try this script instead:

local RootSpecie = workspace.RootSpecie
local SpecieNumber = 0
local Year = 50
local Yearmini = 10
for i = 1,4 do
	local Specie =  RootSpecie:Clone()
	
	local attachment1 = Instance.new("Attachment",Specie)
	attachment1.Name = 'RootAttachment1'
	
	local Attachment2 = Instance.new("Attachment",RootSpecie)
	Attachment2.Name = 'RootAttachment2'
	
	local beam = Instance.new("Beam",Specie)
	beam.Name = 'RootBeam'
	-- getting ready
	Specie.BrickColor = BrickColor.random()
	Specie.Parent = workspace["Evolution Tree"]
	Specie.Position = Specie.Position + Vector3.new(
		math.random(-30, 30),
		math.random(Yearmini, Year),
		math.random(Yearmini, Year)
	)
	Specie.ParentSpecie.Value = RootSpecie.Name
	beam.FaceCamera = true
	beam.Attachment0 = attachment1
	beam.Attachment1 = Attachment2
	beam.Color = ColorSequence.new({
		ColorSequenceKeypoint.new(0,Specie.Color),
		ColorSequenceKeypoint.new(1,RootSpecie.Color)

	})

end

for _, SpecieI in pairs(workspace["Evolution Tree"]:GetChildren()) do
	for i = 1,10 do
		local Specie =  SpecieI:Clone()
		
		local rootBeamInstances = {'RootBeam','RootAttachment1','RootAttachment2'}
		for _, child in Specie:GetChildren() do
			if table.find(rootBeamInstances,child.Name) then
				child:Destroy()
			end
		end
		
		local attachment1 = Instance.new("Attachment",Specie)
		local Attachment2 = Instance.new("Attachment",SpecieI)
		local beam = Instance.new("Beam",Specie)
		-- getting ready
		Specie.BrickColor = BrickColor.random()
		Specie.Parent = workspace["Evolution Tree"]
		Specie.Position = Specie.Position + Vector3.new(
			math.random(-30, 30),
			math.random(Yearmini, Year),
			math.random(Yearmini, Year)
		)
		Specie.ParentSpecie.Value = SpecieI.Name
		beam.FaceCamera = true
		beam.Attachment0 = attachment1
		beam.Attachment1 = Attachment2
		beam.Color = ColorSequence.new({
			ColorSequenceKeypoint.new(0,Specie.Color),
			ColorSequenceKeypoint.new(1,SpecieI.Color)

		})
	end
end
1 Like

omg, thank you so much,. My brain been burning for decade

1 Like

Your welcome. Also, I had a small mistake in the code I sent above, as you don’t actually need to check for ‘‘RootAttachment2’’ in the cloned Specie children, as that isn’t cloned along the Specie (since it is parented to RootSpecie)

Hang on, i found bugs.

when i tried repeat 20 time, there is same bugs. Can you fix it?

lua

for i = 1,20 do
for _, SpecieI in pairs(workspace["Evolution Tree"]:GetChildren()) do
	for i = 1,20 do
		if SpecieI["Died?"].Value ~= true then
		local Specie =  SpecieI:Clone()

		local rootBeamInstances = {'RootBeam','RootAttachment1','RootAttachment2'}
		for _, child in Specie:GetChildren() do
			if table.find(rootBeamInstances,child.Name) then
				child:Destroy()
			end
		end

		local attachment1 = Instance.new("Attachment",Specie)
		local Attachment2 = Instance.new("Attachment",SpecieI)
		local beam = Instance.new("Beam",Specie)
		-- getting ready
			SpecieNumber += 1
			Specie.Name = "Specie_"..SpecieNumber
		Specie.BrickColor = BrickColor.random()
		Specie.Parent = workspace["Evolution Tree"]
		Specie.Position = Specie.Position + Vector3.new(
			math.random(-30, 30),
			math.random(Yearmini, Year),
			math.random(-30, 30)
		)
		Specie.ParentSpecie.Value = SpecieI.Name
		beam.FaceCamera = true
		beam.Attachment0 = attachment1
		beam.Attachment1 = Attachment2
		beam.Color = ColorSequence.new({
			ColorSequenceKeypoint.new(0,Specie.Color),
			ColorSequenceKeypoint.new(1,SpecieI.Color)

		})
			if math.random(1,30) == 1 then
				Specie["Died?"].Value = true
			end
		end
		end
end
end

image

for i = 1,20 do
for _, SpecieI in pairs(workspace["Evolution Tree"]:GetChildren()) do
	for i = 1,20 do
		if SpecieI["Died?"].Value ~= true then
		local Specie =  SpecieI:Clone()

		for _, child in Specie:GetChildren() do
			if child:IsA('Attachment')  or child:IsA('Beam') then
				child:Destroy()
			end
		end

		local attachment1 = Instance.new("Attachment",Specie)
		local Attachment2 = Instance.new("Attachment",SpecieI)
		local beam = Instance.new("Beam",Specie)
		-- getting ready
			SpecieNumber += 1
			Specie.Name = "Specie_"..SpecieNumber
		Specie.BrickColor = BrickColor.random()
		Specie.Parent = workspace["Evolution Tree"]
		Specie.Position = Specie.Position + Vector3.new(
			math.random(-30, 30),
			math.random(Yearmini, Year),
			math.random(-30, 30)
		)
		Specie.ParentSpecie.Value = SpecieI.Name
		beam.FaceCamera = true
		beam.Attachment0 = attachment1
		beam.Attachment1 = Attachment2
		beam.Color = ColorSequence.new({
			ColorSequenceKeypoint.new(0,Specie.Color),
			ColorSequenceKeypoint.new(1,SpecieI.Color)

		})
			if math.random(1,30) == 1 then
				Specie["Died?"].Value = true
			end
		end
		end
end
end
1 Like

Thank you, my bean aren’t render tho but that still goal

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.