My generator works but leaves 3 tiles (36x36 space) out once close to the spawn, it’s always the same shape and position. The shape has an “<” shape. The issue is that players can fall trough those spots out the map and it looks unprofessional. I used (procedural generation)
There arn’t any error messages.
Here is my code btw:
local RegularTilesFolder = serverStorage.Level_0.RugularZone
local spawnTile = serverStorage.Level_0.SpawnTile
firstTile = spawnTile:Clone()
firstTile.Parent = game.Workspace.Level_0
firstTile:MoveTo(Vector3.new(0,-100,0))
function create(v)
local newTile
if v.TileToPlace.Value == nil then
newTile = RegularTilesFolder:GetChildren()[math.random(1,#RegularTilesFolder:GetChildren())]:Clone()
else
newTile = RegularTilesFolder:GetChildren()[v.TileToPlace.Value]
end
newTile.Parent = game.Workspace.Level_0
newTile:PivotTo(CFrame.new(v.Position) * CFrame.fromOrientation(math.rad(v.Orientation.X), math.rad(v.Orientation.Y), math.rad(v.Orientation.Z)))
return newTile
end
local newTiles = {}
function generate(PreviousTile: Model)
for i,v in pairs(PreviousTile:GetChildren()) do
if v:IsA("BasePart") and v.Name == "NewTileStart" then
local newTile = create(v)
local GetPartsInPart = game.Workspace:GetPartsInPart(newTile.Collision)
if #GetPartsInPart > 1 then
newTile:Destroy()
else
table.insert(newTiles,newTile)
end
end
end
wait(0)
for i,v in pairs(PreviousTile:GetChildren()) do
if v:IsA("BasePart") and v.Name == "NewTileStart" then
v:Destroy()
end
end
table.remove(newTiles,table.find(newTiles,PreviousTile))
for i,v in pairs(newTiles) do
generate(v)
end
end
generate(firstTile)