Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you spawn an Instance.new part and turn it into a sphere?

So, I've been trying to figure out how to give an Instance.new part a Ball shape when it spawns in. This is all I can come up with:

part = Instance.new("Part",game.Workspace)
part.Shape =  Ball

Honestly, I am very bad at scripting, and an answer would help alot!

2 comments

0

Either put "Ball" in quotes or use part.Shape = Enum.PartType.Ball. The latter is recommended to use rather than just quotes.

0

Depricated parent in instance.

1 answer

You're setting the shape to an undefined variable called Ball. Instead, we need to use the Enum object to get the part type. It would look like this:

part = Instance.new("Part",game.Workspace)
part.Shape =  Enum.PartType.Sphere

2 comments

0

Don't define instance parents inside of the Instance.new() call - both for idiomatic purposes as well as performance.

0

you can also insert a sphere mesh into the part, but this method works better, and yea, you shouldn't use the parent parameter of Instance.new

This discussion is preserved as it was. New answers, comments, and votes are closed.