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

How could I improve my script for making the camera face my npc?

1 answer

✓ Accepted answer

Firstly, let's organize the script using that little blue button on top of your text box area.

local npc = workspace.npc
local Camera = workspace.CurrentCamera --Try to use `local` not `Local`.
Camera.CameraType = Enum.CameraType.Scriptable -- This makes sure the camera is scriptable and able to manipulate.

Now, if you want to make a camera face something or someone instantly, you can do;

Camera.CFrame = npc.Head.CFrame

However, if you wanted to make it smoothly transition to the npc's head, then do;

--Make sure to add a part where you want the camera to be looking from to looking at.
--I'll call the part "LookPart"
Camera:Interpolate(workspace.LookPart.CFrame,npc.Head.CFrame,0.5) --< Change the number according to how fast you want it to be.
--The first arguement of the `Interpolate` function is where the camera will look from.
--The second arguement represents where you want to look at.

I hope I helped!

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