So, I'm trying to make a factory in my game, and I want conveyor belts pumping out parts constantly. I already know how to make a conveyor belt, but I need to know how to create something that keeps producing the same part on certain intervals of time. If anyone could help, it would be greatly appreciated! -Future
COMMUNITY QUESTION
How to make a part generator?
1 answer
To do something repeatedly, we use a form of loop. Since we want to do this indefinitely, a while loop is most appropriate.
while wait(10) do
-- Every ten seconds, do the following:
-- To make a brand new part:
part = Instance.new("Part", workspace)
-- Construct a new Part instance in the workspace
-- Put the new object in the variable `part` so we can do stuff to it
-- Or instead, to copy an existing part
-- (only use this or the above, not both)
part = game.ReplicatedStorage.FactoryObject:Clone()
-- Make a Clone (exact copy) of a given object
-- (may be in other places but I just picked
-- ReplicatedStorage for this example)
part.Parent = workspace
-- Move that object into the workspace (otherwise it is invisible
-- and essentially non-existent)
part.Position = script.Parent.PartSpawner.Position
-- Move the part to the position of a `PartSpawner` (example)
-- For CSG objects, the above still works.
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
Oh my god BlueTaslem! I love your portal game, anyway, thanks for the answer, but I have more more question: I created a certain part using solid modeling I want to be looped, but how would I enter that specific part in the script?
I will modify my answer to account for that
thanks! I'm not exactly great with scripting yet :p
How do I move the part to the position of a ''PartSpawner''?
Sorry i'm a noob at scripting.. :c
That code is included there. The comments document the lines immediately above them
Which line is it? (sorry for wasted your time :p