Putting all your scripts in separate forever loops means things can happen out of order. You want collision detection to happen a̲f̲t̲e̲r̲ moving something by its velocity. If it happens before, then you have 1 frame where the thing has moved but collision hasn't been applied, and then said thing snaps back at the start of the next frame. Bonus points if you separate X and Y collisions. That way you can still move sideways while touching the floor. It doesn't make slopes work, but it's something. Not sure if I'm making any sense here, so please ask if you have questions.