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

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

Asked by
M9F 94
3 years ago
Edited 3 years ago

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
0
Solved M9F 94 — 3y

4 answers

Log in to vote
0
Answered by
M9F 94
3 years ago

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
Ad
Log in to vote
0
Answered by 3 years ago
local npc = game.ReplicatedStorage.Name:Clone()
npc.Parent = game.Workspace
npc.Name = "CustomName"

You could do this it would be more simple

Log in to vote
0
Answered by
valk_3D 140
3 years ago

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
Log in to vote
0
Answered by
2Loos 168
3 years ago
Edited 3 years ago

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!

Answer this question