Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I clone 100 parts at a time?

Asked by 4 years ago
local UIS = game:GetService("UserInputService")

function spawnsphere ()
    local new100parts = Instance.new("Part")
    new100parts.Parent = workspace
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
        new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()
    new100parts:Clone()

end

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.F then
        print("RIP")
        spawnsphere()
    end
end)

1 answer

Log in to vote
1
Answered by 4 years ago

Hey!

You should use a for-loop:

function spawnsphere()
    local new100parts = Instance.new("Part", workspace);

    for i = 1, 100 do
        new100parts:clone().Parent = workspace;
    end
end

game:GetService('UserInputService').InputBegan:connect(function(input)
    if input.KeyCode == Enum.KeyCode.F then
        spawnsphere();      
    end
end)
0
Don't use the second parameter of Instance.new() as it is very inefficient than manually setting the instance's parent. youtubemasterWOW 2741 — 4y
Ad

Answer this question