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

how to clone multiple times?

Asked by 5 years ago

i am trying to make then destroy an item multiple times i am using :clone() but it is not working because after i do :destroy() the item wont get cloned a second time. is there any way to make it not do this thanks in advance

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

If you're trying to create a script that creates a part then destroys it and repeats it, then i'd recommend using the repeat or a while loop to solve this. Always give a script to increase your chance of having someone answer it. Here's what you can do to clone something.

if script.Disabled == false then
        repeat
        game.Workspace["Model Name Here"]:Destroy() --Delete this entire command to just have it clone continuously.
        print("Deleted") --Delete this entire command to just have it clone continuously.
        wait(0.5) --Delete this entire command to just have it clone continuously.
        game.ServerStorage["Model Name Here"]:Clone().Parent = game.Workspace
        wait(0.5)
        print("Cloned")
    until
    script.Disabled == true
end

Again, you're not giving any scripts so i'm making my own. You'd need a GUI Button or a script that turns this off after a while. Here you go though! It works perfectly fine on my end. > Where it says delete, delete those lines only and then you'll have it consistently multiply, DO NOT REMOVE THE WAIT otherwise your game will crash as it'll continue to clone in milliseconds .

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

I don't know how this have been solved just type

for i = 1,10 do

    wait()

    local Part = script.Part:Clone()
    Part.Parent = game.Workspace
    game.Debris:AddItem(Part, 1)

end

Answer this question