Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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!

0
Either put "Ball" in quotes or use `part.Shape = Enum.PartType.Ball`. The latter is recommended to use rather than just quotes. EzraNehemiah_TF2 3552 — 5y
0
Depricated parent in instance. greatneil80 2647 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

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
0
Don't define instance parents inside of the Instance.new() call - both for idiomatic purposes as well as performance. SummerEquinox 643 — 5y
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 theking48989987 2147 — 5y
Ad

Answer this question