Facing a play towards a part

Im trying to make a player face a part after they have died so they know what direction to go. At first I thought the script below, but when I am in first person or have shiftlock on it does not. I don’t know why.


if character.PrimaryPart and stageStat.Value < 100 then --Just make sure the character’s
HRP has loaded
local characterPos = character.PrimaryPart.Position
local targetPos = workspace.Checkpoints:FindFirstChild(“Checkpoint” … stageStat.Value + 1).Position
local newCFrame = CFrame.new(characterPos, targetPos)
character:SetPrimaryPartCFrame(newCFrame)
end


You may have to disable shiftlock/first person, cause no matter what the Character Model will always be facing relative to where the Mouse is moving when Shiftlock/First Person is enabled

Another potential alternative to use is the Humanoid.AutoRotate property which completely disables the Character from rotating around

local Humanoid = Character:WaitForChild("Humanoid")

if Character.PrimaryPart and stageStat.Value < 100 then
    local characterPos = Character.PrimaryPart.Position
    local targetPart = workspace.Checkpoints:FindFirstChild("Checkpoint"..stageStat.Value + 1)
    
    if targetPart then
        Humanoid.AutoRotate = false

        local targetPos = targetPart.Position
        local newCFrame = CFrame.new(characterPos, targetPos)
        character:SetPrimaryPartCFrame(newCFrame)

        wait(1)
        Humanoid.AutoRotate = true
    end
end

Also 1 minor suggestion, but you could check first for the Part you’re trying to find so that it doesn’t error & then reference the Position afterwards :thinking:

1 Like

I havent had any errors with the parts because the amount of them always stays the same. Here is the script I have now and a video of what’s happening below it.


character.Humanoid.AutoRotate = false
local characterPos = character.PrimaryPart.Position
local targetPos = workspace.Checkpoints:FindFirstChild(“Checkpoint” .. stageStat.Value + 1).Position
local newCFrame = CFrame.new(characterPos, targetPos)
character:SetPrimaryPartCFrame(newCFrame)
wait(0.5)
character.Humanoid.AutoRotate = true


https://streamable.com/v8mz6s

Are you trying to make like the actual Player’s Camera face towards a Part? (Or in the direction it’s supposed to go) Cause if you’re in First Person, you won’t be able to see those changes happen on your screen as your BodyParts turn invisible upon doing so

The AutoRotate property only changes the Character’s rotation, but not where the Camera’s exactly facing

1 Like

But the way the players camera is facing is the same way the players character is facing. So I don’t understand why it wont work.