Any way to change the shape of an instance being added by script?

whenever you add an instance using Instance.new(“Part”) its always a default normal Part. Is there any way to change this?

I believe your looking for the part.Shape property

https://developer.roblox.com/en-us/api-reference/property/Part/Shape

not from the generic Instance.new(“Part”) but you can configure it inside the script!

as an example to change the color, size, position, really anything in the properties tab


local newPart = Instance.new("Part") -- creates new part
newPart.Color = Color3.fromRGB(162, 139, 255) -- light purple
newPart.Name = "NewPart"
newPart.Parent = game.Workspace
newPart.Anchored = true
newPart.CanCollide = true
newPart.Shape = Enum.PartType.Cylinder -- this can be a Ball, Block, Cylinder, for a regular part just dont add this in
2 Likes

lets say you created a model that you wanted the instance to be like. Any way to do that?

you would be capable of cloning it, but you would have to store it in either Lighting (old fashion way of storing things), but preferably ReplicatedStorage in a folder called “PossibleInstances”. as an example you can place a model inside of that folder then in your script write


local PossibleInstances = game.ReplicatedStorage.PossibleInstances --this locates your folder
local DesiredInstance = PossibleInstances.Car --car as example, this would be your model name though

local CopyOfDI = DesiredInstance:Clone() --clone the DesiredInstance so its usable more than once

CopyOfDI.Parent = game.Workspace --bring the clone to workspace

then of course you can make your changes using the script i talked about before but with more specifications into the model

1 Like