Is there a "Best Method" to change the property of an object or GUI, like for example the transparency of a Frame in a GUI. There are two ways that I know of, I could either use a for-loop or TweenService to change the transparency. Is there another way that I am missing?
Does one cause more lag? Can one be more efficient? Does one look more appealing?
Here's a for-loop for the transparency of a block
local block = script.Parent
while true do
for i = 1, 10 do
block.Transparency = block.Transparency + 0.1
wait(1)
end
wait(2)
for i = 1, 10 do
block.Transparency = block.Transparency - 0.1
wait(1)
end
wait(2)
end
Here's the TweenService for the transparency of a block
local block = script.Parent
local ts = game:GetService("TweenService")
local tween = nil
function tweenObject(t)
local info = TweenInfo.new(10)
return ts:Create(block, info, {Transparency = t})
end
while true do
tween = tweenObject(1)
tween:Play()
wait(12)
tween = tweenObject(0)
tween:Play()
wait(12)
end
Which one is the better method to use? Or under some circumstances, which one should be used?

3 comments
There is no major performance difference. As you may know, TweenService allows for Enum choice and various other customization options which would otherwise need to be added in via math when it comes to interpolation - which is why it is more preferable in some cases.
Note that with a for loop, you can set the step to .1. Thus simplifying your example for loops immensely. Example: for i = 0, 1, .1 do block.Transparency = i. Similarly, you can do a negative step.
Example: for i = 1, 0, -.1 do block.Transparency = i.