local tweenservice = game:GetService("TweenService") local top = script.Parent local info = TweenInfo.new( 2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0 ) local Goals = { Position = Vector3.new(35.3, 5.388, -120.506) } local tween = tweenservice:Create(top,info,Goals) wait(5) tween:Play() top.Changed:Connect(function() top.Anchored = false local tweenservice = game:GetService("TweenService") local info = TweenInfo.new( 2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0 ) local Goals = { Transparency = 1 } local tween = tweenservice:Create(top,info,Goals) tween:Play() end)
I mean, you could make that all a function
function tween(Time,Style,Direction,Properties,Object) local tweenService = game:GetService("TweenService") local Info = TweenInfo.new(Time,Enum.EasingStye[Style],Enum.EasingDirection[Direction]) return tweenService:Create(Object,Info,Properties) end tween(1,"Sine","Out",{Color=Color3.fromRGB(0,255,0)},script.Parent):Play() --Example 1 tween(1,"Sine","Out",{Color=Color3.fromRGB(0,0,0)},script.Parent):Play() --Example 2
it takes tweenservice, then makes the tweeninfo out of the parameters it has, then creates a tween with the Object, Info, and the Properties. And this can be used multiple times