I’m not sure what’s wrong with my loading bar. There is no error messages, yet it doesn’t work. Please help, and have a great day.
Script:
local Frame = script.Parent.Parent.Parent.Parent.Frame
local Indicator = script.Parent.Parent.IndicatorFrame
local Load = 0
while wait() do
Load = Load + 0.01
Indicator:TweenSize(UDim2.new(Load, 0, 0, 65), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
end
if Load <= 0.575 then
Frame:TweenPosition(UDim2.new(0.5, 0, -2, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
end
What do you mean it doesn’t work? What happens when you test it? Does it do nothing or does it do something completely different from what you want it to do?
It is not our job here on this forum to look through your script for you, understand your problem for you, and correct it for you. Throwing your script onto this forum and saying “please help” is not enough.
Based on this, it seems as if you want the bar to stop at about 57.5 percent of the total length of the bar.
Try this one-liner that I wrote based on the context of what I could gather from your first script: Frame:TweenSizeAndPosition(UDim2.new(.575, 0, 0, 65), UDim2.new(.5, 0, -2, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
Your script is going to go on forever.
Based on your replies, you want it to stop at 0.575?
while Load <= 0.575 do
Load += 0.01
Indicator:TweenSize(UDim2.new(Load, 0, 0, 65), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
wait()
end
Frame:TweenPosition(UDim2.new(0.5, 0, -2, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1) -- then do the tween I assume comes after the loading bar?
Using while loops without a delay will cause errors. It may prevent the script from running because of the execution time-out. But if not that, the value will be multiplied so many times.
If you want it to work smoothly, you can use the ContentProvider service so you can see how many assets are left to load. You can use PreloadAsync() to check how many assets are in queue to be loaded. This service will show the real number of assets that are not loaded.
local assetsCount = 0
local ContentProvider = game:GetService("ContentProvider")
local list = {
game.ReplicatedStorage.Tree
game.ReplicatedStorage.Car
game.ReplicatedStorage.Pencil
end
for i, parts in ipairs (list) do
ContentProvider:PreloadAsync({parts})
assetsCount += 1
script.Parent.Text = "Assets left to load " .. assetsCount .. " / " .. #list
script.Parent.AnotherTextLabel.Text = "Class name of the asset: " .. parts.ClassName
end
And if you want to add TweenPosition function, use it after for loop.