I made Tweening Easier

I wrote this ModuleScript to make writing tweens easier for myself by omitting the TweenInfo entirely (in some cases).

It has a default_tween_info setting which can be overridden with a parameter. Since most of my tweens follow the default_tween_info, it means that I save myself time writing it.

--[=[
	@voozy_v | 2025 Mar 31
]=]

local config = {
	default_tween_info = TweenInfo.new(
		1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut
	)
}

local tweenService = game:GetService("TweenService")

--[[
	Creates, plays, and returns a <code>Tween</code> using a predefined <code>TweenInfo</code>.
	To override the default <code>TweenInfo</code>, simply pass a <code>TweenInfo</code> object as the third parameter.
]]
return function(instance:Instance, propertyTable:{}, tweenInfo:TweenInfo?)
	assert(instance, `BasePart expected, got {instance and instance.ClassName or "nil"}`)
	assert(propertyTable and typeof(propertyTable) == "table", `Table expected, got {typeof(propertyTable) or "nil"}`)
	
	local tween = tweenService:Create(instance, tweenInfo and tweenInfo or config.default_tween_info, propertyTable)
	tween:Play()
	
	return tween
end

Normal usage:
Screenshot 2025-04-01 211403

Overriding TweenInfo with your own settings:

Also has its own description and basic type annotations for the nerds.

very nice, is config to add other types of tweens?

Thanks. All tweens made with the module will have the TweenInfo of config.default_tween_info unless you provide your own.

1 Like

Is it possible to make this also tween models?

To tween a model, you just have to weld all the parts to one part (could be invisible) and tween that part. So yes, this module still uses Tween() which you can use to tween a model.

I meant like class-type model.