Is there a way to specify how my times I want something Cloned?

like Clone(4)

4 meaning 4 of the same objects.

2 Likes

I don’t think it exists, but you can use for. for i=1,v = 4 do --stuff to do end
i=1 means it will start counting with 1 so : 1,2,3,4; if you put 0 it will do like this: 0,1,2,3,4 so five times v how you surely already got is the number of times you repeat the action. EDIT: You should explain your problem better, else many people wont understand.

2 Likes

No that doesn’t exist in Lua, you will have to create a for loop like what jcnruad900 has said.

for i = 1, 4, 1 do
    local clone = workspace.Part:Clone()
    clone.Parent = workspace
    clone.Name = "Part"
end

It can just be as simple as this, where each increment the loop goes is when it clones the part. Here is a for loop article for more information: For Loops And here is a clone article as well: Clone()

Also another thing to note is to search things before posting topics on the developer forum because this could have been answered from these articles.

5 Likes

there isnt anything like that, you can achieve this with either for loops or while loops;

While loops (I won’t recommend this but its also useful);

local start = 0; -- This is your starting position
local amnt = 4; -- Number of times it will clone

while start < amnt do
Model:Clone();
Model.Parent = workspace;
start = start + 1;
end

For Loops;

local amnt = 4 --Number of times it will clone

for i = 1, amnt, 1 do
Model:Clone();
Model.Parent = workspace;
end
1 Like