How to tween camera to player?

Hi, I am making a menu and when the player clicks play, I want it to tween the camera to the player.

Right now, I have it so that the camera is set to a part when the player joins.

The error I’m having is TweenService:Create property named 'CameraSubject' cannot be tweened due to type mismatch (property is a 'Object', but given type is 'Instance')

How do I fix this?

local ts = game:GetService("TweenService")
local blur = game.lighting:WaitForChild("MenuBlur")

script.Parent.MouseButton1Click:Connect(function()
	local ti = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
	local tween = ts:Create(blur, ti, {Size = 0})
	tween:Play()

	local camtween = ts:Create(workspace.CurrentCamera, ti, {CameraSubject = game.Players.LocalPlayer.Character.Humanoid})
	camtween:Play()
	
	script.Parent.Parent.Enabled = false
	workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end)

Thanks!

btw, this is a local script

Get the CFrame of the camera before you add it to the part, then when you tween make it go to that stored CFrame value.

1 Like

The error ur getting its because ur setting the camera subject to the humanoid (the humanoid being an object, and u have to set the camera subject to an instance) , try setting it to the head

It still has the same error as last time

try with the primary part of the character
rlly weird error

I did it, but when the tween completes, it just goes back to the camPart

Don’t tween the camera subject, tween the cframe.

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