using clamp would work
player set x to clamp(10,400,mouse.x)
player set y to clamp(10,800,mouse.y)
I had to guess the numbers, but the 10 should be the width of the walls, the 400 should be the projectwidth-the width of the walls
800 = projectheight-width of the wall..