Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my loop break after i reaches 61?

Asked by 3 years ago

Please can someone explain why. I have tried so many prints but none of them help Code is probably messy but here:

local lastData = data
local lt = 1
local count = 0
for i = 1, width * height do
    local v = data.pixelData[tostring(i)]
    local pixelData = v
    local x = pixelData.pixelLocation.x or 0
    local y = pixelData.pixelLocation.y or 0
    local part = Instance.new('Frame', surf)
    part.Size = UDim2.new(0,1*divide,0,1*divide)
    part.BorderSizePixel = 0
    part.Position = UDim2.new(0, (x*divide)-(1*divide), 0, (y*divide)-(1*divide))
    part.BackgroundColor3 = Color3.fromRGB(pixelData.pixelRgb.r, pixelData.pixelRgb.g, pixelData.pixelRgb.b)
    part.Name = "pixel"..pixelData.pixelId
    lt += 1
    count += 1
    print(count, " / " ..i)
    if lt > 25 then
    -- Make sure it won't freeze
    wait(0.1)
    lt = 0
    end
end

also width * height is more than 61 and there is code after this that doesnt run either. (width * height is 6000 in my case)

Answer this question