Unable to cast value to Object

I’m trying to tween the camera to a part but i keep getting the error “Unable to cast value to Object”

local plr = game:GetService('Players').LocalPlayer
local camera = workspace.Camera
local Cams = workspace:WaitForChild('Cams')

local tweenService = game:GetService('TweenService')

script.Parent.MouseButton1Click:Connect(function()
	camera.CameraType = Enum.CameraType.Scriptable
    tweenService:Create(camera.CFrame, TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {CFrame = Cams.Cam1.CFrame}):Play()
end)

Try changing create(camera.cframe with create(camera

1 Like

The first parameter of the :Create function you passed the cameras cframe whereas the function requires a instance. So to fix the issue you would just only pass in the camera instance like the post above mentioned

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.