Tween not working in module script

I’m trying to make a tween function in my module script. But I keep getting the error “Unable to cast to dictionary”. Both scripts are below. All help appreciated!

Module Script:

module.tween = function(part, goal, duration, easingDirection, easingStyle)
	local TweenService = game:GetService("TweenService")
	
	local tweenInfo = TweenInfo.new(duration, easingStyle, easingDirection, 0, false, 0)

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

	tween:Play()
end

Server Script:

moduleScript.tween(game.Workspace.Part, Vector3.new(-5.63, 4.25, -6.63), 1, Enum.EasingDirection.In, Enum.EasingStyle.Linear)

Your issue is that you’re passing in a Vector3 when the goal expects a dictionary, try this?

modubeScript.tween(game.Workspace.Part, {Position = Vector3.new(-5.63, 4.25, -6.63)}, 1, Enum.EasingDirection.In, Enum.EasingStyle.Linear)

So it tweens the position

1 Like