How do I get the player in front of the part

Im making a portal game where you can go through portals. I’m having an issue where the player will not go in front of the part, what I mean is when you touch the part I want the player to come out facing the same direction going in to make it seem less, but the issue I’m having is in some cases the player teleports into a wall the portal is on and you get stuck in it, please tell me how to get the player to teleport in front of the portal part so you don’t get stuck.

Code im using to teleport:

hit.Parent.HumanoidRootPart.CFrame = CFrame.new(orangePortal.Position + orangePortal.CFrame.LookVector) * CFrame.fromEulerAnglesXYZ(0, math.rad(180), 0)

Assuming that the front face of orangePortal is facing the direction you want the portal to be facing, your best bet would probably be to set the character’s CFrame equal to orangePortal’s. When you do this, the character will take on both the position and orientation of the portal. You can then offset the character from the portal by some amount (1 stud?):

hit.Parent.HumanoidRootPart.CFrame = orangePortal.CFrame * CFrame.new(0, 0, -1)