hey im making a seed/flood fill script for my ROBLOX PAINT game
but the thing is: it fills in everything
then it gets REALLY laggy (ive kinda fixed the laggy part with a 'break' thingy)
i think its just this part because it seems to ignore the position for the most part:
if (frames[i][3]==frames[frame1][3]-1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][2]==frames[frame1][2]-1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][3]==frames[frame1][3]+1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][2]==frames[frame1][2]+1 and frames[i][1].BackgroundColor3==bcolor) then
but heres the whole thing if u think its something else:
function fill(frame,bcolor) local frameX = 0 local frameY = 0 local frame1 = nil for i=1,#frames do if frames[i][1]==frame then frameX=frames[i][2] frameY=frames[i][3] frame1=i end end repeat wait() until frame1 for i=1,#frames do if frame1 then --print("jesus christ does this work") if (frames[i][3]==frames[frame1][3]-1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][2]==frames[frame1][2]-1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][3]==frames[frame1][3]+1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][2]==frames[frame1][2]+1 and frames[i][1].BackgroundColor3==bcolor) then frames[i][1].BackgroundColor3=color fill(frames[i][1],bcolor) print("filled") break end end end end
thanks!!!