Hey everyone, thanks in advance for taking some time…
I’m having trouble with a table operation, loop, where I want to clone an object from ReplicatedStorage into multiple models in the workspace… I have the cloning process and how many I need figured out, but I can’t figure out how to drop them into each model. I also have to position the objects within each model so basically im trying to just loop each new (cloned) object into each model and have it position them too…
One table is the “mail boxes” (workspace models)
The other table is the objects I want to put in (11 new Clones)
First I Clone the object as many times as needed then distribute them into each separate model? Is this even the right path to take for this?
What it does now is clone everything but puts them all into the last workspace model in the table, instead of evenly distributing them into each model in the table
local Boxes = workspace.PaperRoute.Boxes
local newBoxes = {}
local addGoals = Boxes.Small:GetChildren()
for index = 1, 11 do
local newGoal = goal:Clone()
table.insert(newBoxes, #newBoxes + 1, newGoal)
end
for index, newGoal in ipairs(newBoxes) do
newGoal.Parent = addGoals[#addGoals]
newGoal.CFrame = CFrame.new(addGoals[#addGoals].PrimaryPart.Position)
newGoal.Rotation = Vector3.new(addGoals[#addGoals].PrimaryPart.Orientation)
end
I’ve tried doing it with a “repeat” but no luck…