This function is used to create an object of the specified class by codes.
This function takes the class name as the parameter, and returns the created object. This function cannot create the service object.
When the parent of the created object is not specified, it defaults to WorkSpace. It is recommended that, when creating an object, if you want to specify the parent, you can specify it at the end of the script, in order to only specify it once when the object is created, rather than modify the object's property after creation.


Variable name Type Default Description
ClassName string Class name of object specified to creat

Return Value

Type Description
RWObject Class name of object specified to creat


Use the following script to create a red part in WorkSpace.

local temp1 = RWObject.Create("Part") -- create a part and assign it to the variable temp1
temp1.Position = Vector3.New(3,2,3)
temp1.Anchored = true -- fix temp1
temp1.Color = Vector3.New(255,0,0) -- set the color of temp1 to (255,0,0), that is red
temp1.Parent = WorkSpace -- specify the parent of temp1