so basically I am trying to make a thing where it spawns this block in 5 out of the 7 places.
it works, but sometimes overlaps it.
local unusedpositions = {}
local usedpositions = {}
while wait() do
for _,obj in pairs(script.Parent.SpawnZones:GetChildren()) do
table.insert(unusedpositions,obj)
end
for i =1,#script.Parent.SpawnZones:GetChildren()-2 do
local v = math.random(#unusedpositions)
local laser = script.Parent.TallPart:Clone()
laser.Parent = workspace.MapsInGame
laser.Position = unusedpositions[v].Position
laser.Size = unusedpositions[v].Size
table.insert(usedpositions,v)
table.remove(unusedpositions,v)
end
wait(.5)
for i,v in pairs(usedpositions) do
table.remove(usedpositions,i)
end
workspace.MapsInGame:ClearAllChildren()
end