You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? A loading screen
-
What is the issue? I get an error saying
Unable to cast to Array -
What solutions have you tried so far? I’ve checked the PreloadAsync() API and looked over some posts but none of them have helped me
here’s the script (under the GUI in StarterGui)
-- services --
local TweenService = game:GetService("TweenService")
local ContentProvider = game:GetService("ContentProvider")
-- variables --
local loadingScreen = script.Parent
local itemsToLoad = workspace:GetDescendants()
-- code --
for i,v in pairs(itemsToLoad) do
loadingScreen.MainFrame.TextLabel.Text = "Loading... "..math.floor(i/#itemsToLoad).."%"
loadingScreen.MainFrame.LoadingFrame.LoadingBar.Size = UDim2.new(i/#itemsToLoad, 0,1,0)
ContentProvider:PreloadAsync((v))
end
print("finished loading")
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.