Teleport bug

Hi, I have a problem: I placed a triggerbox in a hallway, wich teleports the player to a specific distance. But if the player walks into the wall while touching the triggerbox, he gets teleported way farther then where he should be?

Can you show the code?