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
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