Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

(Self Solved)Script to clone part in ServerStorage is cloning but only once?

So I've set up an infinite loop to clone a part in my server storage. The script is only creating one clone.

local object = game.ServerStorage.Part3

local partClone = object:Clone()

local infinite = 1

repeat
	wait(2)
	partClone.Parent = game.Workspace
	partClone.Position = Vector3.new(-181.17, 28.53, -2.32)
	print("Test")
until infinite == 0

1 comment

0

Solved

4 answers

I fixed the code by simply putting the variable in the repeat function.

local object = game.ServerStorage.Part3

local infinite = 1

repeat
    wait(2)
    local partClone = object:Clone()
    partClone.Parent = game.Workspace
    partClone.Position = Vector3.new(-181.17, 28.53, -2.32)
    print("Test")
until infinite == 0
local npc = game.ReplicatedStorage.Name:Clone()
npc.Parent = game.Workspace
npc.Name = "CustomName"

You could do this it would be more simple

just a few small tweaks

object = game.ServerStorage.Part3

partClone = object:Clone()

infinite = 1

repeat
	wait(2)
	partClone = object:Clone()
	infinite = infinite - 1
	partClone.Parent = game.Workspace
	partClone.Position = Vector3.new(-181.17, 28.53, -2.32)
	print("Test")
until infinite == 0

Why have you guys made it this hard! Just clone it and then easily move it to workspace!

local object = game.ServerStorage.Part3
local partClone = object:Clone() --Clones part
partClone.Name = "ClonedPart" --Put the name you want between the quotes.
partClone.Parent = game.Workspace --Moves to workspace
partClone.Position = Vector3.new(-181.17, 28.53, -2.32) --You've got this right!

This discussion is preserved as it was. New answers, comments, and votes are closed.