Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make the camera face a part?

Asked by 6 years ago

Hi so I'm creating something where when the player touches something, the camera is supposed to look at the player. The camera part is looking at the player's humanoidrootpart, and the camerasubject is the camera part. When I change it to scriptable, because I dont want the player to be able to move the camera, it doesn't work. The camera stays at the same place, but nothing else works. When I change it to anything else, the camera faces the player, but the player is able to move the camera. How can I fix this? This is the code.

cam.CameraType = Enum.CameraType.Scriptable
CameraPart.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new(10,5,1)
cam.CameraSubject = CameraPart
CameraPart.CFrame = CFrame.new(CameraPart.Position,Player.Character.HumanoidRootPart.Position)

1 answer

Log in to vote
0
Answered by
Nonaz_jr 439 Moderation Voter
6 years ago

I'm not sure I understand.. Don't you mean to set the

cam.CoordinateFrame

instead of creating and rotating a 'CameraPart' (which is now set as the subject?)

Ad

Answer this question