I’ve been trying to figure out how to make parts spawn in an unsymmetrical area, but I can’t think of an idea myself nor any sources that could help
this is my current script, which works fine for a symmetrical area, but I want it to be able to wrap around buildings without spawning inside of them
local area = game.Workspace.SpawnArea
local x = area.Size.X/2
local y = area.Size.Y/2
local z = area.Size.Z/2
local function spawn()
local newPart = Instance.new("Part")
newPart.Position = area.Position + Vector3.new(math.random(-x, x), math.random(-y, y), math.random(-z, z))
newPart.Parent = game.Workspace
end
while wait(5) do
spawn()
end
and here’s an example image of what I mean by an unsymmetrical area:
