but it gets off the line more often than needed
Quotebut it gets off the line more often than neededWhy? That seems to be what you need to address, rather than figuring out how to find the line again.
JimboZA, it has 6 sensors, 3 on each side, and usually when no sensors see anything the line is between them, so it should go forward, when it goes off the line no sensors see anything, so i can't really make it go back or anything else, because it won't go forward when its needed
Yep and you need to think through the steps up to going off.You can't rely on all sensors seeing nothing, as you say, since you don't know if it's crashed out or going perfect. You need to keep track of the states... if the 3 left sensors all see the line in order from inner to outer you know it veered off to the right. You need to track that, to know if it crashed off or going perfect.You could consider a central sensor.....