Hello there! I wanted to know if it is possible to change the amount of time the a tween plays using math.random. The script works but it seems as if the math.random function triggers only once then uses that random number thorought the full tween for the rest of its time being played.
Here is the script I got, I’m trying to get the number to change every time the tween is played but I’m unsure of why this isn’t working. If you could help, thanks!
local Image = script.Parent.BrightShade
do
local random1 = math.random(0.5, 2.2)
local random2 = math.random(0.7, 4)
local tweenInfo = TweenInfo.new(
random1, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
random2 -- DelayTime
)
local tween1 = TweenService:Create(Image, tweenInfo, {ImageTransparency = .98})
tween1:Play()
end