So I'm trying to make a nice stroke for a button in game which I wanted to make a cool RGB transition in loop, I made it no problems with this code:
local main = script.Parent.Main function Start(speed) local Start2 = function(speed) print("Empiezo") for i = 0, 1, speed%2/100 do task.wait(0.01) main.UIStroke.Color = Color3.fromHSV(i,1,1) print(i) if i > 1 then i = 0 print(i) end end Start(speed) end Start2(speed) end local RGB = coroutine.create(function() Start(1) -- 1 = fast -> 0.1 = slow end) coroutine.resume(RGB)
I know it's not the prettiest way to write it so I tried using TweenService
like this:
main.UIStroke.Color = Color3.fromHSV(0.001, 1/1, 1/1) TS:Create(main.UIStroke, TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, math.huge, true, 1), {Color = Color3.fromHSV(1,1/1,1/1)}):Play()
In my head they should work the same way but they don't. The idea I had is that since I used a porcentage value it should tween into 0.005 --> 0.010 --> ...
Is there a way to solve what's happening with that tween? Any clues in how TweeningService
interpolates values?