Hello, Im wondering if there is a way to make parts spawn in a random position in a region
And I actually don’t know-how. but I know a way but I tried that method that I know and it didn’t work very well
It is subjective whether you want to spawn the parts inside the bounding box with nothing sticking out or extend out of it but keep the parts’ center inside. Which one are you actually looking for?
I want to use Region3 To Spawn Parts Inside a Region
Since Region3
does not feature any random positions of this, break this down into a random position of all axis using Vector.new()
and math.random()
.
Vector.new(math.random(xMin, xMax), math.random(yMin, yMax), math.random(zMin, zMax))
Note: Max >= Min, or else it won’t work!
1 Like
Will it work if I want to use SetPrimaryPartCFrame of a model
Only if you envelop CFrame.new()
on top of that, hence the function’s name.
1 Like