Unable to cast to dictionary

Hey there!

I’m having a little issue here.
Somehow the logs say: Unable to cast to dictionary
I can’t find what is going wrong here. Maybe some of you do.
I appreciate any help.
The issue occurs at the bottom line of the below code (The tween itself).

local Cam = workspace.CurrentCamera
Cam.CameraType = "Scriptable"
Cam.Focus = CFrame.new(469, 126, 29)
Cam.CoordinateFrame = CFrame.new(418, 137, 107)

local tweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, 0)
local tween = game:GetService("TweenService"):Create(Cam, tweenInfo, {CFrame = CFrame.new(418, 137, 107),CFrame.new(469, 126, 106),25})
4 Likes

Remove two last values in table CFrame.new(469, 126, 106) and 25

1 Like

Alright. I will try this. Hold up.

2 Likes

Have to try the other cframe. But probably it works. Can’t say yet.

1 Like

Okay, that didn’t worked. It just instantly goes back to my player ( tween.Completed:Connect() )

1 Like

But did it fixed the “Unable to cast to dictionary” error?

1 Like

Yes it did fixed the error (It’s not there)

But didn’t fixed what the camera actually should do.

The old script is:

local Cam = Workspace.CurrentCamera
Cam.CameraType = "Scriptable"
Cam.Focus = CFrame.new(469, 126, 29)
Cam.CoordinateFrame = CFrame.new(418, 137, 107)
Cam:Interpolate(CFrame.new(418, 137, 107),CFrame.new(469, 126, 106),25)

And that one worked… But I saw Interpolate is deprecated and just wanted to recode it.

2 Likes

i think the first and second argument to interpolate are start and end points

to convert to a tween you should set it to the initial position and then tween to the end position

local Cam = Workspace.CurrentCamera
Cam.CameraType = "Scriptable"
Cam.Focus = CFrame.new(469, 126, 29)
Cam.CoordinateFrame = CFrame.new(418, 137, 107)

Cam.CFrame = CFrame.new(418, 137, 107)

local tweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, 0)
game:GetService("TweenService"):Create(Cam, tweenInfo, {CFrame = CFrame.new(469, 126, 106)}):Play()


1 Like

Oh. Alright. I will see if this works :slight_smile:

Still not what I was looking for. But I just recently fixed it myself using the old camera method.

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