I remember seeing some function or whatever its called, that waits for a tween to finish playing. Unless I’m delusional, but I can’t seem to find it anywhere in the documentation.
--[services]--
local TweenService = game:GetService("TweenService")
--[variables]--
local grad = script.Parent.UIGradient
local gradRotateTi = TweenInfo.new(2,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0)
local gradRotate1 = TweenService:Create(grad, gradRotateTi, {Rotation = 180})
local gradRotate2 = TweenService:Create(grad, gradRotateTi, {Rotation = 0})
--[functions]--
function gradLoop()
while true do
grad.Rotation = 0
gradRotate1:Play()
if grad.Rotation == 180 then
grad.Rotation = -180
gradRotate2:Play()
end
task.wait(gradRotate2) -- How to wait for tween to finish tweening?
end
--[Start of file]--
if script.Parent.Visible == true then
gradLoop()
print("Useless script is successfully running or you're blind.") -- but it isn't..so..
end
end
I know I could probably use an if statement to check the rotation value or simply wait for the tween time of 2, but it just seems unproductive and I want to learn more efficient functions that I can use in the future.
Currently the print statement doesn’t even output so I am quite sure this is the issue here…