local function TrackHead(inputType, value)
if last == nil then
local x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 = value:GetComponents()
Cam.CFrame = CFrame.new(Head.Position.X, Head.Position.Y, Head.Position.Z, r00, r01, r02, r10, r11, r12, r20, r21, r22)
last = Cam.CFrame
end
if inputType == Enum.UserCFrame.Head then
local x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 = value:GetComponents()
local x2, y2, z2, r002, r012, r022, r102, r112, r122, r202, r212, r222 = last:GetComponents()
local xd = x - x2
local yd = y - y2
local zd = z - z2
local r00d = r00 - r002
local r01d = r01 - r012
local r02d = r02 - r022
local r10d = r10 - r102
local r11d = r11 - r112
local r12d = r12 - r122
local r20d = r20 - r202
local r21d = r21 - r212
local r22d = r22 - r222
last = CFrame.new(Head.Position.X,
Head.Position.Y,
Head.Position.Z,
r002 + r00d,
r012 + r01d,
r022 + r02d,
r102 + r10d,
r112 + r11d,
r122 + r12d,
r202 + r20d,
r212 + r21d,
r222 + r22d
)
local a,b,c,d,e,f,g,h,i,j,k,l = (last:ToWorldSpace() * CFrame.Angles(0,rot,0)):ToObjectSpace():GetComponents()
Cam.CFrame = CFrame.new(Head.Position.X, Head.Position.Y, Head.Position.Z, d,e,f,g,h,i,j,k,l)
Root.CFrame = CFrame.new(Root.Position, Root.Position+Vector3.new((Cam.CFrame.lookVector.X),0,(Cam.CFrame.lookVector.Z)))
end
end