My map is always missing just ONE tile

I have a script that clones thousands of tiles, but one is always missing, and it’s random.
Screenshot (865)


local ogtile =  map.Background_Tile
ogtile.Parent = map.Tiles

local row = ogtile.Position

for i = 1,512 do
	local tileclone = ogtile:Clone()
	tileclone.Parent = map.Tiles
	tileclone.Position = row
	row = tileclone.Position+tileclone.CFrame.RightVector*-tileclone.Size.X
	
	local col = tileclone.Position+tileclone.CFrame.UpVector*tileclone.Size.Y
	for j = 2,512 do
		local tileclone = tileclone:Clone()
		tileclone.Parent = map.Tiles
		tileclone.Position = col
		col = tileclone.Position+tileclone.CFrame.UpVector*tileclone.Size.Y
	end
end

What am I doing wrong?

Hi you should have some waiting periods between spawning in your objects, otherwise the server will get exhausted quite quickly. In the sample below, we have a wait between each row, but you can always chop your total amount of tiles into chunks of 10, 25 or 50 ect. When that is said:

local RowX =  100
local RowZ = 100
for CurX = 1, RowX do
	for CurZ = 1, RowZ do
		local NewTile = Tile:Clone()
		NewTile.Position = Vector3.new(NewTile.Size.X*CurX,0,NewTile.Size.Z*CurZ)
		NewTile.Parent = workspace
	end
	task.wait()
end
1 Like

Your script works really well, but is there a way I can make it so that it generates from a specific point?
The starting position vector3 is 1022, -1022, 5.5.

edit: never mind i figured it out, I just subtracted numbers from the vector3.

wait… HUH?? So I got it to work 99.99999999% perfectly but STILLLL???

For debugging, add a counter inside the row Z and make it go up and then print it after it’s done.

So what I did was print(RowY) and I got 512 (x262144), somehow an even number.

No. You are supposed to increment a value inside the inner loop and print that out after.

local e = 0

for CurX = 1, RowX do
	for CurY = 1, RowY do
		local NewTile = ogtile:Clone()
		NewTile.Position = Vector3.new(NewTile.Size.X*CurX-startPos.X,NewTile.Size.Y*CurY+startPos.Y,0+startPos.Z)
		NewTile.Parent = map.Tiles
		e += 1
	end
	task.wait()
end

print(e)

got same result 262144

Yeah, that sounds right to me. Try setting CFrame instead of position.

local e = 0

for CurX = 1, RowX do
	for CurY = 1, RowY do
		local NewTile = ogtile:Clone()
		NewTile.CFrame = CFrame.new(NewTile.Size.X*CurX-startPos.X,NewTile.Size.Y*CurY+startPos.Y,0+startPos.Z)
		NewTile.Parent = map.Tiles
		e += 1
	end
	task.wait()
end

print(e)

poop

Add a breakpoint if NewTile is nil

So I did this but “ahh” never prints.

for CurX = 1, RowX do
	for CurY = 1, RowY do
		local NewTile = ogtile:Clone()
		NewTile.CFrame = CFrame.new(NewTile.Size.X*CurX-startPos.X,NewTile.Size.Y*CurY+startPos.Y,0+startPos.Z)
		NewTile.Parent = map.Tiles
		e += 1
		
		if not NewTile then
			print("ahh")
		end
	end
	task.wait()
end

print(e)

Your script works, wait time or not, but it seems to be a rendering issue. The “invisible” part is indeed that; simply invisible…It does exist, and if you change a property or even move the part it will reappear. I’m unsure as to what the solution for this would be, possibly adjusting the rendering property of the tiles or even something as simple as changing the transparency of all parts to “0” after creating them all.

1 Like

You’re actually completely right! It does exist, but now it’s a game of cat and mouse.


Do you think separating the tiles into different folders would help?

Edit: I adjusted the tile and made the render fidelity automatic, and it has seemed to fix it.

Edit: Crap. Nevermind.

Edit: Do you think I somehow hit the max amount of parts?

I think the answer is to either change your rendering engine in Lighting, or just turn “CastShadow” off of your template brick. Tested it a few times and it worked but can’t guarantee anything. Hope it helps!

I did a couple more things and it works. If 01 studio doesn’t release the people playground multiplayer mod then damn, I’m gonna have to make people playground 2.5D w/ multiplayer just so I can play with my friend lol

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.