Hello developers!
Today I was trying to make npc/dummy talk to you. I tried to make camera go to his head with CFrame but it didn’t work and I don’t know why, (I am new at scripting thats probably why) i am gonna put script under below and if someone knows what it is i would be more than happy to know
have a good day!
Part of script that contains CFrame (no errors occur in output, it just doesn’t move)
if Chatting == true then
local Humanoid = detectedNPC:FindFirstChild("Humanoid")
local HMR = detectedNPC:FindFirstChild("HumanoidRootPart")
if Humanoid and HMR then
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = camera.CFrame:Lerp(HMR.CFrame * CFrame.new(-4, 4, -7) * CFrame.fromOrientation(math.rad(-20), math.rad(215), 0), 0,07)
end
else
camera.CameraType = Enum.CameraType.Custom
end
Alright, if there are no errors and the code is running, that likely means that the math for the CFrame just isn’t what you want. Does your camera move anywhere when this code is running by the way?
You can try using TweenService to get the smooth effect.
Put local TS = game:GetService("TweenService") at the top of the script, and then change the camera CFrame bit to this.