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

How do I use Clone()?

Asked by
NecoBoss 194
9 years ago

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

3 answers

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago
--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.
Ad
Log in to vote
0
Answered by
war8989 35
9 years ago

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.

Log in to vote
0
Answered by
extrorobo 104
2 years ago

-- 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()

Answer this question