How to make Character always face towards a direction

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I am working on a game where the player always moves forward. At the end of the session the player will be teleported back to the origin point. The player should always face forward when they get teleported

  2. What is the issue? Include screenshots / videos if possible!
    The issue I currently have is that if the player looks any other direction before being teleported, they wont be teleported facing forward (For obvious reasons). How do I make it so when they get teleported, they face a certain direction?

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried using body gyros but then this bug can happen:
    https://gyazo.com/fcf93431ed1841e6e54d6b4c0638f789
    ^^ basically what is happening above is that the player can still move towards the left or the right if they rotate.

1 Like

You must use SetPrimaryPartCFrame in its character when teleporting it or if you must ALWAYS face one direction, use it but within a loop that uses your position. you could also place a loop to keep it on an axis.

if you want to disable character rotating, then you can set the humanoid autorotate to false, and for making it face a certain direction, you can do something like this:

local root = workspace:WaitForChild("person").HumanoidRootPart
local direction = workspace.coolpart.CFrame.LookVector

root.Parent.Humanoid.AutoRotate = false
root.CFrame = CFrame.new(root.CFrame.p, root.CFrame.p + direction)
5 Likes

What if I want to let the player rotate but when they get teleported they face the same way again

1 Like