Roblox Script Clone Parts with self properties

Posted on April 26, 2020

Cloning a Part is very interesting since you can also cloning its own attached script.

This opers interesting possibilities, such as make the Part always different.

Suppose you have a MyPart in ServerStorage:

And the Main script with:

local p = game.ServerStorage["MyPart"]:Clone()
p.Parent = game.Workspace

The Part is created when the game starts.

Now, add the following code in MyScript:

local p = script.Parent

local height = math.random(2, 100)

p.Size =, height, 20)
p.Position =, 0, -23)
p.Anchored = true
p.Name = "ClonedPart"
p.BrickColor =,0,0)

You should see something like:

The Part has been created and modified at run-time.

Nothing stop us to add much more logic in MyScript, though.