How can I tween a Progress bar using the code provided bellow?
for i= 1, #instances do
local current = instances[i]
ContentProvider:PreloadAsync({current})
end
I think I would use
i / #instances -- for geting the progress
How can I tween a Progress bar using the code provided bellow?
for i= 1, #instances do
local current = instances[i]
ContentProvider:PreloadAsync({current})
end
I think I would use
i / #instances -- for geting the progress
Personally I would do something like this:
local bar = Bar.PathTo
for i= 1, #instances do
ContentProvider:PreloadAsync({instances[i]})
bar.Size = Udim2.new(i / #instances, 0, 1, 0)
end
You can use TweenSize method
local Bar = (bar path)
for i= 1, #instances do
local current = instances[i]
ContentProvider:PreloadAsync({current})
Bar:TweenSize(UDim2.new(goal size), easing Direction, easing Style, time)
end
TweenSize is deprecated. Now you should use tweenService :
local TweenService = game:GetService("TweenService")
local ContentProvider = game:GetService("ContentProvider")
local T_INFO = TweenInfo.new(
0.1, -- time
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out
)
local instances = -- put ur instances here
local bar = -- put the path to the bar
for index, instance in instances do
ContentProvider:PreloadAsync({instance})
TweenService:Create(bar, T_INFO, {Size=UDim2.fromScale(index/#instances, 1)}):Play()
end
You can also use RunService if you want a linear tween. If you want to be at the exact loading progress in real time u should use @Azul_Litt answer. The bar could tp tho.