I'm making a tool right now and there's only one problem with it: The ball that it creates won't grow less than a stud at a time because its FormFactor keeps switching to Symmetric after I set it to Custom in the script. It only works in the Command Bar after it's been spawned, and to have to add that detail later in the script would make it more complicated than necessary. I can't use a Mesh because the ball relies on precise collisions. Here's the code, it creates everything described except the "Custom" part. Any ideas as to why?
b=Instance.new("Part",workspace) b.Size=Vector3.new(1,1,1) b.Anchored=true b.CanCollide=false b.CFrame=workspace.BasePlate.CFrame b.TopSurface="Smooth" b.BottomSurface="Smooth" b.Shape="Ball" b.FormFactor="Custom"
For reasons I cannot fathom, the Ball
shape does not let you use Symmetric
sizing, despite being able to set non-symmetric sizes using Studio's tools.
The simplest workaround I can suggest is making a Ball brick into a Union. Unions can be scaled up/down to almost whatever size you want, and keep their sphere physics and materials.
You can't make the Union itself from a script; you'd have to make :Clone
s from ReplicatedStorage or ServerStorage.
view source
1 b=Instance.new("Part",workspace)
2 b.Size=Vector3.new(1,1,1)
3 b.Anchored=true
4 b.CanCollide=false
5 b.CFrame=workspace.BasePlate.CFrame
6 b.TopSurface="Smooth"
7 b.BottomSurface="Smooth"
8 b.Shape="Ball"
9 game.Workspace:WaitForChild(b)
b.FormFactor="Custom"
Problem
You only set the FormFactor once, instead you need to put it in a loop. This will continuously set the formfactor, so it doesn't change when you go to edit it.
Solution
Loop your code, so it sets the FormFactor more than once.
while true do b = Instance.new("Part", workspace) b.Size = Vector3.new(1, 1, 1) b.Anchored = true b.CanCollide = false b.CFrame = workspace.BasePlate.CFrame b.TopSurface = "Smooth" b.BottomSurface = "Smooth" b.Shape = "Ball" b.FormFactor = "Custom" wait() --Always use wait() to end while true do loops. Not doing this will result in studio crashing, or crashing in-game. end