I can run this sometimes, and it will work, but it will only generate parts on the outside of the brick (but if I shrink it it generates fine?)
Code:
local spawnBase = workspace.Baseplate local point1 = Vector2.new(-spawnBase.Position.X-(spawnBase.Size.X/2),spawnBase.Position.Z+(spawnBase.Size.Z/2)) local point2 = Vector2.new(spawnBase.Position.X+(spawnBase.Size.X/2),-spawnBase.Position.Z-(spawnBase.Size.Z/2)) local point3 = Vector2.new(-spawnBase.Position.X+(spawnBase.Size.X/2),-spawnBase.Position.Z-(spawnBase.Size.Z/2)) local point4 = Vector2.new(spawnBase.Position.X-(spawnBase.Size.X/2),spawnBase.Position.Z+(spawnBase.Size.Z/2)) local randomX = math.random(point1.X,point4.X) local randomZ = math.random(point1.Y,point3.Y) local part = Instance.new("Part"); part.Parent = workspace part.Anchored = true part.CFrame = CFrame.new(randomX,spawnBase.Position.Y+(spawnBase.Size.Y/2),randomZ)
Error: "ServerScriptService.Script:8: bad argument #2 to 'random' (interval is empty)"
At line 8
local randomZ = math.random(point1.Y,point3.Y)
point1.Y
is higher than point3.Y
The first argument of math random will be the minimum number and the second the maximum