I've heard about loading screens... (PreloadAsync)

I’ve looked around the DevForum and found developer.roblox.com to show me about PreloadAsync. But, I still couldn’t quite understand the use of it and how to use it for loading screens, considering that I am making a game soon. It would be really nice to have some help! Thanks.

PreloadAsync is basically an instance’s function when you need for it to wait(yield) the script before execution until that instance is fully loaded and its children, almost like using WaitForChild(probably?)
https://developer.roblox.com/en-us/api-reference/function/ContentProvider/PreloadAsync
image

I put the name wrong. I meant to say that I already looked on that page and still didn’t understand it, so I was asking for help here.

1 Like

It can be used to load stuff like decals,sounds before the player has entered. It’s useful for loading screen for stuff like loading bars.

1 Like

First parameter put a table of instances(sounds, decals) that you want to load them and their descendants, for example:

{game.Players.LocalPlayer.PlayerGui}
{playergui.ScreenGui.Decal, workspace.Sounds}

Notice that workspace.Sounds thing, it will load the children inside it also so i dont have to give it all instances i want to load.

Second parameter, if you want to you can give it a function that will get fired when a asset for example you can give:

function()
print("we loaded a asset")
end

Now this gives me a small idea of it! Thanks!