Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I change camera subject to a player and keep it facing forward?

So, I'm using the direct "Camera Manipulation" code example off the Roblox wiki with some small modifications.

local target = game.Players.LocalPlayer.Character.Torso
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0
 
while wait() do
    camera.CoordinateFrame = CFrame.new(target.Position)
                           * CFrame.Angles(0, angle, 0)
                           * CFrame.new(0, script.Position.Value, 10) 
end

My goal is this camera will be on the Player stationary. The issue is, if the player walks and turns another direction before this camera is active, the camera does not position directly in front of the character (side with the face). Sometimes it does, sometimes it doesn't depending on the rotation/position of the player before it is active.

Is there a way I can make the camera always face the front (face side) of the player?

1 comment

0

The only thing I can think of is to put this before wait()

1 answer

if I remember, use Fixed. Or what ever I think I'm not sure.

This discussion is preserved as it was. New answers, comments, and votes are closed.