I have a script that makes a flashlight copy the rotation of the camera. I have also used a formula to make the movement smoother, which is shown in the code.
function tween(o,t,s)
o = o + (t-o)*s
return o
end
local x,y,z,lx,ly,lz= 0,0,0,0,0,0
runservice.RenderStepped:Connect(function()
x,y,z = cam.CFrame:ToOrientation()
print(y)
lx = tween(lx,x,.25)
ly = tween(ly,y,.25)
lz = tween(lz,z,.25)
fl:SetPrimaryPartCFrame(head.CFrame * CFrame.new(0,0,-1) )
fl.fpart.Orientation = Vector3.new(math.deg(lx),math.deg(ly),math.deg(lz))
end)
However, the problem is that because of the way orientation works, when the Y rotation reaches a certain point it switches to a negative number. This causes the “tween” formula to jump. In the video below, the Y-axis rotation is printed in the console for better visualization
I honestly never use orientation so I wouldn’t know, they look completely different tho
On another note, the gmod game you’re making looks very promising, I wonder what is down that funny dark corridor
edit: the jump seems to be because the orientation skips from 3 to -3, and your tweening tries to smoothly jump between those 2 axes (axiseseses) so it winds up going the long way, not sure