Frame generation is breaking

It is supposed to generate a grid, but for some reason when I put the frame size to 5, it breaks.

When the frame X and Y size is 10:


When the frame size is 5:

The only difference of code between videos is the 10 is a 5 and a task.wait().

Impossible to say without the code.

Sorry I forgor
(max is the number in the output in the videos)

for CurY = 0, max do
	for CurX = 0, max do
		local frame = game.ReplicatedStorage.Frame:Clone()
		frame.Parent = cg
		frame.Position = UDim2.new(0,CurX*frameSize,0,CurY*frameSize)
		--task.wait()
		--if CurY > 70 then
			--d += 1
			--if d >= 100 then
			--	d = 0
			--task.wait()
			--print(CurX,CurY)
			--end
		--end
	end
	--task.wait()
end