Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Camera won't Tween properly?

Asked by 3 years ago
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.

0
it's a simple error it's just saying it want's a vector3 value instead of a CFrame value MarkedTomato 810 — 3y
0
I understand the error but if I give it what it wants it hates me more RYANGAMES11 17 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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

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. RYANGAMES11 17 — 3y
Ad

Answer this question