tween:Play() should return tween (and other apis too when applicable)

This is more of a clean code preference so nothing is impossible/hard but:
currently if I want to wait for a tween to complete I have to do:

local tween = TweenService:Create(v,info,{
	Color = color,
	Position = centroid,
	Size = origin,
	Transparency = 1,
})
tween.Completed:Connect(function()
				
end)
tween:Play()

if tween:Play() would return tween obj I could instead do

TweenService:Create(v,info,{
	Color = color,
	Position = centroid,
	Size = origin,
	Transparency = 1,
}):Play().Completed:Connect(function()
				
end)

And this just looks way cleaner, takes up less lines, and doesnt require creating a local

Ideally all apis that could use this functionality would employ it too to make everything easier to use

17 Likes

Yeah. There are dozens of functions and APIs I’ve wanted to have return certain values instead of nil. For example, I’d have print and warn return the string passed.

S u p p o r t

5 Likes