Some of my factory components were not found can u help me?

I created a table with some factory components in them on running the game some of the components were not found how can i fix this?

Can you post a bit more information what you did and what happened? Preferrably screenshots and code too.

local platform_heights = {80, 280, 480 ,680, 880, 1080  }
local coin_heigths = { 160,  360, 560, 760, 960, 1160 }


local facts = {'#platform_factory', '#platform_long_factory', '#platform_other_factory'}


-- the problem is with the two tables below------------------------------------------------------------------------
local obs = {"#arrowsign_factory", "#shrub2_factory", "#shrub1_factory", "#shrub3_factory","#shrub4_factory"}
local trees ={"#tree2_factory","#tree3_factory"}
---------------------------------------------------------------------------------------------------


function init(self)
	timer = 0
	world_speed = 9
end	


function update(self, dt)
	timer = timer +1
	if timer % 30  == 0 then
		height = platform_heights[math.random(#platform_heights)]
		fact = facts[math.random(#facts)]
		local facter = factory.create(fact, vmath.vector3(1600, height, 0), nil, {}, 1)
		c_height = coin_heigths[math.random(#coin_heigths)]
		local coiner = factory.create('#coin_factory', vmath.vector3(1600, c_height, 0), nil, {}, 0.5 )
	
	elseif timer % 2000 == 0 then
		local starer = factory.create('#star_factory', vmath.vector3(1700, c_height, 0), nil, {}, 1)
	elseif timer % 60 == 0 then
		-- the factory components -----------------------------------------------------
		ob = obs[math.random(#obs)]
		local ober = factory.create(ob , vmath.vector3(1700, c_height, 0), nil, {}, 1)
		tree = trees[math.random(#trees)]
		----------------------------------------------------------------------------------
	world_speed = world_speed + 0.001
	msg.post(facter, "set_speed", {speed = world_speed})
	msg.post(coiner, "set_speed", {speed = world_speed})
	msg.post(starer, "set_speed", {speed = world_speed})
end		

function on_message(self, message_id, message, sender)
	if message_id == hash("dead") then
		print(timer)
	end	
end
		
function final(self)
end			
		
		
	

I placed the factory components in a go file and put the file in the level collection

Does all of the factories exist on the same game object as the script us attached to?

yh they do

What kind of error message do you get?

Component not found

Well, that error message is a clear indication that one or more factory components do not exist on the same game object. Please zip the project or share it through the Dashboard with me (sync it first) and I’ll take a look, bjorn.ritzl@king.com.

1 Like

thanks guys

1 Like

Have you shared it? What’s the name of the project?