If you need any extra info, I will post it.
I am using the PolyDraw Module BTW.
So, I am running a loop. And it stops running after going through only a couple of times.
function SetChunkSize(NX, NY) print("SettingChunkSize") local Chunksize = ChunkSize local Tilesize = TileSize if NX == -1 or NX == 1 or NY == -1 or NY == 1 then Chunksize = Vector2.new(((Chunksize.X-1)/2)+1, ((Chunksize.Y-1)/2)+1) Tilesize = Tilesize * 2 elseif NX == -2 or NX == 2 or NY == -2 or NY == 2 then Chunksize = Vector2.new(((Chunksize.X-1)/4)+1, ((Chunksize.Y-1)/4)+1) Tilesize = Tilesize * 4 end print(Chunksize.X .. ":" .. Chunksize.Y .. "_" .. Tilesize) return Chunksize, Tilesize end local function GenerateTriangles(XOffset, YOffset, NX, NY, Chunksize) local Chunk = Instance.new("Model", game.Workspace) Chunk.Name = XOffset .. ":" .. YOffset for X = 0, Chunksize.X-1 do if X ~= Chunksize.X-1 then for Y = 0, Chunksize.Y-1 do if Y ~= Chunksize.Y-1 then print(X .. ":" .. Y) local A, B, C, D = Chunks[Chunk.Name][X .. ":" .. Y], Chunks[Chunk.Name][X + 1 .. ":" .. Y], Chunks[Chunk.Name][X .. ":" .. Y + 1], Chunks[Chunk.Name][X + 1 .. ":" .. Y + 1] local Tri1 = PolyDraw.Tri.new(Chunk, A, B, C) local Tri1 = PolyDraw.Tri.new(Chunk, B, C, D) end end end if First == false then wait() end end end
NOTE: This is not the whole script. The loop is in the GenerateTriangles function. Anyone know why it stops?
Output: Player:-1, 0 SettingChunkSize 3:3_512 0:0 0:1 0:2