Unable to cast dictionary

Hello! I am making creating a tween but my head is not working at all tonight. The output says “Unable to cast dictionary” and no other topic has helped.

	local TweenService = game:GetService("TweenService")

		local part = game.Workspace.AerialBombers.PrimaryPart

		local goal = game.Workspace.ABGuides.Finish

		local tweenInfo = TweenInfo.new(5)

		local tween = TweenService:Create(part, tweenInfo, goal)

		tween:Play()
1 Like

TweenService:Create takes a dictionary for the third parameter. Is goal supposed to be the goal Position or CFrame?

The goal position #charscharschars

Your tween is supposed to look like this:

local tween = TweenService:Create(part, tweenInfo, {Position = goal.Position})

Position is the property being tweened, and goal.Position is the value to be tweened to

1 Like

This works, but only the primary part of the model is tweened. How do I tween the whole model?

1 Like

That’s actually a bit more complicated (goes beyond just a service call) because the position properties on Models are locked (though, that doesn’t mean it can’t be done).


You can either use this module (there’s a few more available, this one is just the first one that popped up):

(It includes code samples if you’re confused)

Or, you can weld everything in the model to the PrimaryPart (which will move the objects with the PrimaryPart), then tween it. But I don’t know if that will break any system that you’re using


If you use the module, your code should look like this:

local module = require(path.to.ModuleScript)
module.TweenModulePosition(game.Workspace.AerialBombers, tweenInfo, goal.Position)
1 Like

I’ll probably try the module, however when I tried welding all parts together only the primary part moved.

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