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

How do I use Clone()?

I am trying to make a clone of a part in server storage. How do I accomplish this?

3 answers

--You're going to want to use a server side script for this, local scripts will not work.
--Go to the part you want to clone from ServerStorage.
game.ServerStorage.Part
--With that, put :Clone() on the end, ROBLOX will make a nil duplicate, so it should go like so.
game.ServerStorage.Part:Clone()
--And to take it into workspace just put a .Parent = workspace at the end.
game.ServerStorage.Part:Clone().Parent = workspace --The script will clone the object to workspace and you can do that over and over again.

To make a clone of a part in Server Storage do the following:

local storage = game:GetService("ServerStorage")
local part = storage["Part"].clone() -- Change "Part" to the part name.
part.Parent = game.Workspace

That declares the variable storage to Server Storage and a variable part to a clone of a Part named Part in Server Storage, then it parents the clone to Workspace.

This script only works server-side.

-- Get a reference to an existing object

local original = workspace.Model

-- Create the model copy

local copy = original:Clone()

-- Parent the copy to the same parent as the original

copy.Parent = original.Parent

-- Move the copy so it's not overlapping the original

copy:SetPrimaryPartCFrame(CFrame.new(0, 50, 0))

Example of clone()

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