Unintended gaps with a wall of parts

So I’m making a prototype old decal wall, and I’ve noticed that the gap between the different rows should be 0, but it is instead 10… I wanted for it to for every 10 iterations change the Y pos by 2 but I don’t know how to do that at all. I’ve tried every method I know of. Ignore the else if chain please it doesn’t really have anything to do with it

for i=1480,9999,1 do
	local roundedDown = math.floor(i / 10) * 10
	local tonumber2 = tostring(i)
	local chars = {}
	for j = 1, #tonumber2 do
		local char = tonumber2:sub(j, j)
		table.insert(chars, char)
	end
	print(chars[4])
	local fourthDigit = tonumber(chars[4])
	local decalHolder = Instance.new("Part")
	decalHolder.Anchored = true
	decalHolder.Size = Vector3.new(2,2,1)
	decalHolder.Parent = workspace
	local decal = Instance.new("Decal")
	decal.Texture = "rbxthumb://type=Asset&id=" .. i .. "&w=420&h=420"
	decal.Parent = decalHolder
	decal.Face = Enum.NormalId.Front
	if fourthDigit == 0 then
		decalHolder.Position = Vector3.new(0, roundedDown-8, -11.5)
	elseif fourthDigit == 1 then
		decalHolder.Position = Vector3.new(-2, roundedDown-8, -11.5)
	elseif fourthDigit == 2 then
		decalHolder.Position = Vector3.new(-4, roundedDown-8, -11.5)
	elseif fourthDigit == 3 then
		decalHolder.Position = Vector3.new(-6, roundedDown-8, -11.5)
	elseif fourthDigit == 4 then
		decalHolder.Position = Vector3.new(-8, roundedDown-8, -11.5)
	elseif fourthDigit == 5 then
		decalHolder.Position = Vector3.new(-10, roundedDown-8, -11.5)
	elseif fourthDigit == 6 then
		decalHolder.Position = Vector3.new(-12, roundedDown-8, -11.5)
	elseif fourthDigit == 7 then
		decalHolder.Position = Vector3.new(-14, roundedDown-8, -11.5)
	elseif fourthDigit == 8 then
		decalHolder.Position = Vector3.new(-16, roundedDown-8, -11.5)
	elseif fourthDigit == 9 then
		decalHolder.Position = Vector3.new(-18, roundedDown-8, -11.5)
	end
end
1 Like

Fixed it by placing a “y” variable before the loop, then adding this in the very beginning of the loop:

if i % 10 == 0 then
		y = y + 2
	end

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