#Trying to move a gradient

1 messages · Page 1 of 1 (latest)

supple topaz
#

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()

deep dragon
#
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 startingPos = Vector2.new(-1, 0)
local endPos = Vector2.new(1, 0)

gradient.Offset = startingPos

while true do
    local tween = ts:Create(gradient, ti, {Offset = endPos})
    tween:Play()
    tween.Completed:Wait()
    gradient.Offset = startingPos
end

im not supposed to provide code but, this is simple tweening so hopefully it can help u

#

@supple topaz

supple topaz
#

alright

#

let me try it

#

it didnt work for me

#

here is my heirarchy

deep dragon
#

put the script in the button

supple topaz
#

oh ok

#

ty

deep dragon
#

np

supple topaz
#

one last question

#

where you use "button" what would i replace that with for an image label?

deep dragon