Unable to cast to Dictionary when using TweenService with parts

Alrighty, so if you saw my other posts, you would know I’m pretty new to using CFrame, Vector3, etc… so I apologize if this is a very simple question.

Anyway, I’m getting the error Unable to cast to Dictionary for some reason, with no additional errors. I’m not really sure what else to say, nor do I know where to go from here.

local ts = game:GetService("TweenService")
local part = script.Parent

local tweeninfo = TweenInfo.new(
	0.5,
	Enum.EasingStyle.Back, 
	Enum.EasingDirection.Out, 
	0, 
	false, 
	0
)

local goal = CFrame.Angles(0, part.Orientation.Y + 90, 0)

local tween = ts:Create(part, tweeninfo, goal) -- where the error happens

tween:Play()

That is because you’re just passing a CFrame value. Code cannot read your mind.

local goal = { CFrame = part.CFrame*CFrame.Angles(0, part.Orientation.Y + 90, 0) }
2 Likes

I think I tried adding the curly brackets but did it wrong, and that’s what caused me to not know how to proceed.

Thanks for helping! It worked.

local goal = CFrame.Angles(0, part.Orientation.Y + 90, 0)

That isn’t a dictionary.
You can try doing this:

local goal = {Orientation = Part.Orientation + Vector3.new(0, 90)}
1 Like

Just a reminder that CFrame.Angles accepts RADIAN measurements. 90 degrees is equivalent to math.pi/2 radians.

1 Like

Thanks! I’ll keep that in mind. I’m just trying to do simple movements at the moment though.