Here is my script why won’t it work?
Local target = workspace.npc Local camera = workspace.currentcamera
This doesn’t work I’m trying to make it follow this npc for a period of time
Here is my script why won’t it work?
Local target = workspace.npc Local camera = workspace.currentcamera
This doesn’t work I’m trying to make it follow this npc for a period of time
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.
3 comments
This is completely wrong isn’t it
https://developer.roblox.com/en-us/articles/Camera-manipulation
That should help you out ^