local tilesFolder = workspace.Space.Tiles
local tiles = tilesFolder:GetChildren()
for number, tile in tiles do
while task.wait(1) do
local OverlapParams = OverlapParams.new()
OverlapParams.FilterType = Enum.RaycastFilterType.Exclude
OverlapParams.FilterDescendantsInstances = {}
OverlapParams.MaxParts = 4
OverlapParams.CollisionGroup = "Default"
local boundBox = workspace:GetPartBoundsInBox(CFrame.new(tile.Base.Position.X, tile.Base.Position.Y + 4.5, tile.Base.Position.Z), Vector3.new(6, 6, 6), OverlapParams)
if boundBox then
print(#boundBox)
if #boundBox > 0 then
print("Tile", (tile.Base.Position.X / 8), tile.Base.Position.Z / 8, "is occupied!")
else
print("Tile", (tile.Base.Position.X / 8), tile.Base.Position.Z / 8, "is not occupied!")
end
end
end
end
I have this code, which in idea should get all 25 tiles in a folder, and tell which of them occupied and which are not.
While script mostly works, I can not get the printing part to print all tiles, and instead it gets only 1 tile as an answer. How would I get may be a table or a list of occupied/unoccupied tiles?