Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Camera won't Tween properly?

curcam.CameraType = Enum.CameraType.Scriptable

		local tween = tweenService:Create(
			curcam,
			TweenInfo.new(3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
			{CFrame = CFrame.new(target.CFrame)})
		

		tween:Play()
		tween.Completed:Wait()
		cambinded = true

I have been trying to Tween the Players Camera to a Parts .CFrame for the past hour or so trying different things but.

It only works if {CFrame = CFrame.new(target.CFrame)} is {CFrame = CFrame.new(target.CFrame.Position)}

But I want the Position and Rotation. Not just the position, you see the problem here? and I have no idea why but it just spits me this error: invalid argument #1 to 'new' (Vector3 expected, got CFrame) So I decided to turn here to find answers.

2 comments

0

it's a simple error it's just saying it want's a vector3 value instead of a CFrame value

0

I understand the error but if I give it what it wants it hates me more

1 answer

The camera doesn't tween because you have to firstly;

1-Instead of setting the CameraType one time you should do this to make sure the camera is set to scriptable:

repeat
curcam.CameraType = Enum.CameraType.Scriptable
wait()
until curcam.CameraType == Enum.CameraType.Scriptable --Repeat setting the value until it's scriptable

2-The camera doesn't update because you need to update the camera. RunService is a service that can run every frame creating another coroutine. Basically, if you place this at the end of your script, the camera will update:

local RunService = game:GetService("RunService")

RunService.Stepped:Connect(function() --Run every frame
curcam.CFrame = curcam.CFrame --Update the camera
end)

For more information about RunService, you should check: https://developer.roblox.com/en-us/api-reference/class/RunService

1 comment

0

This isn't the solution because the camera does tween if I use target.CFrame.Position instead of target.CFrame. But I need not just it's position to tween but rotation aswell.

This discussion is preserved as it was. New answers, comments, and votes are closed.