Trying to restrict movement of player without causing it to fly off the screen
The box is having weird collision with the player, you can probably see this happening if you use "physics visualization".



To solve, switch the physics type of the box to "static" and have it clamp to the travel path that it needs to glide along. I made a working .blend aside from the "clamp to" because I'm not sure of your situation.