Issue when attempting to create a tween

Hello, I’m trying to make a tween module to make tweeting models/parts easier for myself. The issue I’m having is that when I go to create the tween, I’m getting the following error within the output, Unable to cast to Dictionary. However, I’m using the correct syntax, and not a single value I pass into the function is incorrect. Here’s the code snippet:

local suppliedInformation = TweenInfo.new(
	
		tweenTime,
		tweenType,
		Enum.EasingDirection.Out
	
	);
	
	local isCurrentlyBeingTweened = tweenObject:FindFirstChild('currentlyMoving') or Instance.new('BoolValue');
	isCurrentlyBeingTweened.Name = 'currentlyMoving';
	isCurrentlyBeingTweened.Parent = tweenObject;
	
	repeat wait() until not isCurrentlyBeingTweened.Value
	
	local tweenEndPosition = calculateEndPosition(tweenObject,tweenDirection);
	local completedTween = TweenService:Create(tweenObject,suppliedInformation, tweenEndPosition);

Here’s whats printed into console if I individually print each value:

  21:49:50.308 - tweenstuff
  21:49:50.309 - Time:1 DelayTime:0 RepeatCount:0 Reverses:False EasingDirection:Out EasingStyle:Linear
  21:49:50.310 - -2.00195503, 2.40860224, 12.5956001

Here’s what I’m putting into the console to call the function from the module,

require(game.ReplicatedStorage.Modules.tweenModule):createTween({object = game.Workspace.tweenstuff,direction = 'left',length = 1, type = Enum.EasingStyle.Linear})

Any and all help is appreciated!

1 Like

What kind of value is tweenEndPosition?
The third argument to TweenService:Create is supposed to be a dictionary of properties to be changed. That variable name implies that it is only a Vector3.
If that’s the case, change that to:

TweenService:Create(tweenObject, suppliedInformation, {Position = tweenEndPosition})
2 Likes

I didn’t know this, thanks! This should work!