Avoid what? If you mean the wall, you can simply check if there is a wall at that origin by creating an entity. If the entity touches anything that means there is another entity at the target origin and you can stuck if you teleport there. You can use that information however you want You can abort teleportation or you can teleport targets near. It is up to you.