Camera is not tweening to part

Hello, I am making a system where the camera tweens to a part’s CFrame but it isn’t working.

Local script:

game.ReplicatedStorage.beginEvent.OnClientEvent:Connect(function()
	game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
	local tween = game:GetService("TweenService"):Create(game.Workspace.CurrentCamera.CFrame, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {CFrame.lookAt(game.Workspace.padCameraPart.CFrame)})
	tween:Play()
	tween.Completed:Wait()
	script.Parent.dialogueGUI.Enabled = true
	sayNew("Welcome to your Basic Military Training!")
	wait(2)
	sayNew("In this training, you will learn the basics of becoming a soldier.")
	wait(2)
	sayNew("Firstly, we will have a quiz.")
end)
1 Like

No idea why it does this, but should fix it?

workspace.CurrentCamera:GetPropertyChangedSignal('CameraType'):Connect(function()
	
	workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable;
end)

& Your Goal for TweenService:Create is wrong I believe

game:GetService('TweenService'):Create(workspace.CurrentCamera, TweenInfo.new(...), { CFrame = # })
1 Like

Pretty sure the issue is with your tween. The first argument should solely be the object. Then, have what properties you are tweening in between the { }.

In the end, it should look something like this:

game.ReplicatedStorage.beginEvent.OnClientEvent:Connect(function()
	game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
	local tween = game:GetService("TweenService"):Create(game.Workspace.CurrentCamera, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {CFrame = game.Workspace.padCameraPart.CFrame})
	tween:Play()
	tween.Completed:Wait()
	script.Parent.dialogueGUI.Enabled = true
	sayNew("Welcome to your Basic Military Training!")
	wait(2)
	sayNew("In this training, you will learn the basics of becoming a soldier.")
	wait(2)
	sayNew("Firstly, we will have a quiz.")
end)
1 Like