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:
Overriding TweenInfo with your own settings:
Also has its own description and basic type annotations for the nerds.