Roblox Script Create a Part using code

Posted on April 26, 2020

Creating elements in Roblox is quite straightforward. You need to instance the element you want and you can set its properties:

In the main script, add this code:

local p ="Part", game.Workspace)
p.Size =, 1, 20)
p.Position =, 0, -50)
p.Anchored = true
p.BrickColor =,0,0)

Adding Anchored is required if you don't have a Baseplate in your game. Here the result: