How to make it so the spawnpoints dont spawn in walls?

i want it not to spawn objects in side walls. but idk how to make it

local light = game.ServerStorage.Light
local ylight = game.ServerStorage.YellowLight
local wall = game.ServerStorage.Wall
local spawnpoint = game.ServerStorage.SpawnLocation
local objects = game.ServerStorage.Objects:GetChildren()

-- world generation script

for i = 1, 4000 do
	local newlight = light:Clone()
	local newylight = ylight:Clone()
	local newwall = wall:Clone()
	local newspawnpoint = spawnpoint:Clone()
	local size = math.random(1, 64)
	local rotation = math.random(1, 2)
	newlight.Buzz.Playing = true
	newlight.Parent = workspace.Map.Lights
	newlight.Position = workspace:WaitForChild("Map"):WaitForChild("Carpet").Position + Vector3.new(math.random(-1021, 1021), 32.3, math.random(-1021, 1021))
	newwall.Parent = workspace.Map.Walls
	newwall.Size = Vector3.new(size, 30, math.random(1, 16))
	newwall.Position = workspace:WaitForChild("Map"):WaitForChild("Carpet").Position + Vector3.new(math.random(-1021, 1021), 23, math.random(-1021, 1021))
	newspawnpoint.Parent = workspace.Map.SpawnLocations
	newspawnpoint.Position = Vector3.new(math.random(-1021, 1021), 17.001, math.random(-1021, 1021))
	local placeobject = math.random(1, 100) -- Generate a random number between 1 and 100
	if placeobject <= 5 then -- 40% chance
		local object = objects[math.random(1, #objects)]:Clone()
		object.floor:Destroy()
		object.mainpos.Transparency = 1
		object.Parent = workspace.Map.Objects
		object:SetPrimaryPartCFrame(
			CFrame.new(Vector3.new(math.random(-1021, 1021), 19.272, math.random(-1021, 1021))) * -- Position
				CFrame.Angles(0, math.rad(math.random(0, 360)), 0) -- Random Y-axis rotation
		)
	end
	if rotation == 1 then
		newwall.Orientation = Vector3.new(0, 0, 0)
	else
		newwall.Orientation = Vector3.new(0, 90, 0)
	end
	local walltrim = newwall:Clone()
	local textures = walltrim:GetChildren()
	for i, texture in pairs(textures) do
		texture:Destroy()
	end
	walltrim.Color = Color3.fromRGB(161, 152, 116)
	walltrim.Material = Enum.Material.Plastic
	walltrim.MaterialVariant = "<None>"
	walltrim.Size = newwall.Size + Vector3.new(0.1, -29, 0.1)
	walltrim.Position = newwall.Position + Vector3.new(0, -15, 0)
	walltrim.Parent = workspace.Map.Walls
	walltrim.Name = "WallTrim"
end

note: the objects are spawnpoints

i would recommend after spawning it to use :getpartsinboundbox ( i think thats whats it called ) to check, and if it is touching, it would move the part, basically a loop until it stops touching