local text = script.Parent.Frame.Frame.TextLabel.Text
local barImg = script.Parent.Frame.Frame.ImageLabel
script.Parent.Loadin1.barImg:TweenSize(UDim2.new(1, 0, 1, 0), "Out", "Linear", 25, true)
while wait (0.05) do
local Loading = 35000
Loading -= 214
text = "Loading Workspace ("..Loading..")"
end
try this. I donât really have any time to explain as Iâm about to go:
local text = script.Parent.Frame.Frame.TextLabel
local barImg = script.Parent.Frame.Frame.ImageLabel
script.Parent.Loadin1.barImg:TweenSize(UDim2.new(1, 0, 1, 0), "Out", "Linear", 25, true)
local Loading = 35000
while wait (0.05) do
Loading -= 214
text.Text = "Loading Workspace ("..Loading..")"
end
You didnât encase it inside the loop, you only just Tweened it once and thatâs it
I would also recommend learning about how PreloadAsync can work to efficiently make a loading screen
Oh yeah you also keep setting your Loading variable back to 35000 every time
You should implement sanity checks as well for when the loading is done:
local text = script.Parent.Frame.Frame.TextLabel
local barImg = script.Parent.Frame.Frame.ImageLabel
local Loading = 35000
script.Parent.Loadin1.barImg:TweenSize(UDim2.new(1, 0, 1, 0), "Out", "Linear", 25, true)
while true do
Loading -= 100
text.Text = "Loading Workspace ("..tostring(Loading)..")"
wait(0.05)
if Loading == 0 then
break --This will correctly break the loop & you can remove/invisible the frame
end
end
There was another post stating on why text does not work, and that is because it stores the old value of the text, say your text was âhelloâ and you made a variable on it,
local text = script.Parent.Frame.Frame.TextLabel.Text
when the script runs, it saves this as a variable, it sees you are looking for the text so it then sees âhelloâ and then that is what the variable saves,so this is an important factor to this script, here is the link to a post something like this:
another thing is that your loop does not have a
wait()
nor does it include a
break
you may have included it after while but that is just like saying while true do
I donât know how to explain this but i hope this helps!
local Assets = {} -- All the assets you want to load
local text = script.Parent.Frame.Frame.TextLabel.Text
local barImg = script.Parent.Frame.Frame.ImageLabel
for i = 1, #Assets do
local Asset = Assets[i]
text.Text = "[".. i .. " / "..#Assets.."]"
ContentProvider:PreloadAsync({Asset})
local Progress = i / #Assets
barImg:TweenSize(UDim2.new(Progress, 0, 1, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine, 1, false)
wait(0.1)
end
The only other thing that I see is that you arenât repeatedly tweening your LoadingBar if itâs an actual bar
Either that or youâre doing this on a server script
local text = script.Parent.Frame.Frame.TextLabel
local barImg = script.Parent.Frame.Frame.ImageLabel
local Loading = 35000
script.Parent.Loadin1.barImg:TweenSize(UDim2.new(1, 0, 1, 0), "Out", "Linear", 25, true)
while true do
Loading -= 100
text.Text = "Loading Workspace ("..tostring(Loading)..")"
script.Parent.Loadin1.barImg:TweenSize(UDim2.new(Loading / 35000, 0, 1, 0), "Out", "Linear", 25, true)
wait(0.05)
if Loading == 0 then
break --This will correctly break the loop & you can remove/invisible the frame
end
end