So I am making a racing game, and the make it more advanced, I want to make it so the camera always faces the back of the player, and the player can't zoom in or out. How do I achieve this?
COMMUNITY QUESTION
How do I make the camera always face the back of the player?
1 answer
The methods of CFrames sound pretty handy in this case..
assuming you have access to the player's character, here's a method that might hopefully work
local RunService = game:GetService("RunService");
local camera = x.y.Camera--the camera object
local character = x.y.Character --the player's character
RunService.Stepped:Connect(function()
camera.CameraType = Enum.CameraType.Scriptable
local head = character.Head;
local behind = head.CFrame:ToWorldSpace(CFrame.new(0, 0, 10));
camera.CFrame = CFrame.new(head.Position, behind.Position)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I get "Attempt to index nil with 'x'"
idk the structure of ur script, access the player's camera and character in the context of ur script. this is an example...