The goal of this script is to animate a ui gradient like this https://gyazo.com/c5c33f8431711c7232f3ebf8f72ca528.
local button = script.Parent
local gradient = button.UIGradient
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local offset1 = {Offset = Vector2.new(.75, 0)}
local create = ts:Create(gradient, ti, offset1)
local startingPos = Vector2.new(-1, 0)
local addWait = 0
local function animate()
create:Play()
create.Completed:Wait()
gradient.Offset = startingPos
create:Play()
create.Completed:Wait()
gradient.Offset = startingPos
wait(addWait)
animate()
end
animate()