How to get player to face a direction

Hello DevForums! I wanted to make a script that detects when a part is in front of it and makes the player platform stand. I did so with raycasting, but if I were to jump into a wall, I would be platform standing, but I would be facing the wrong direction.

Example:
robloxapp-20210903-1431185.wmv (560.1 KB)

With this, I was questioning if there was a way to prevent the wrong rotation and flopping around.

use

local Character = --define character how your script would

local function changeDirection()
    local partToLookAt = workspace.Part --change path
    Character.HumanoidRootPart.CFrame = CFrame.new(Character.HumanoidRootPart.Position, part.Position)
end

changeDirection()
1 Like