I have a script that makes camera movement smooth and adds the ability to switch between a third person and first person perspective using a toggle keybind, it uses cframe values to change the camera offset but I want to instead for them to be tweened, but I ran into a error: “Unable to cast value to object” I am not sure why. Here is the portion of the code that I am talking about:
local function ChangeCamera(input)
if input.KeyCode == Enum.KeyCode.Q then
if CAMERA_MODE then
--CAMERA_OFFSET = CFrame.new(3,-0.8,7)
TweenService:Create(CAMERA_OFFSET,TweenInfo.new(1),{CAMERA_OFFSET = CFrame.new(3,-0.8,7)}):Play()
CAMERA_MODE = false
else
--CAMERA_OFFSET = CFrame.new(0,1,-0.5)
TweenService:Create(CAMERA_OFFSET,TweenInfo.new(1),{CAMERA_OFFSET = CFrame.new(0,1,-0.5)}):Play()
CAMERA_MODE = true
end
end
end
I honestly have no idea how to tween cframe values so this is really throwing me for a loop.