Randomized Spawn Parts

hello! is there a possible way to randomized a part when you spawn them and also make them not overlap with any parts in the map?

1 Like

If you mean in studio, then you would require a plugin that does it for you, although it would be quite complicated.

If you mean spawning parts from a script, then yes, absolutely. You could randomize stuff like the part’s size with math.random(minSize, maxSize), and the part’s color and other non-numerical properties by storing a bunch of them in an array and choosing one with myColors[math.random(1,#myColors)].

As for checking whether it’s overlapping with other parts, you have a few options. If the length of part:GetTouchingParts() is more than 0, than you know atleast one part is overlapping with it. You could try decreasing the size, or moving the part around to collect positional information about the overlapping parts to prevent it.