How to Fix Mouse.Hit.p hitting a wall

I am using mouse.hit.p for my game but when a players back is to a wall and they click then the mouse.hit.p is messed up and goes towards the wall instead of continuing like it would normally.