✓ Accepted answer
Hmmm... Not sure, I've used this before and it worked perfectly fine.
Here's another way of doing it, it's just more complicated. Not really sure why it's throwing this error.
local ContentProvider = game:GetService("ContentProvider")
local assets = {
game:GetService("Workspace"),
game:GetService("Players"),
game:GetService("Lighting"),
game:GetService("ReplicatedFirst"),
game:GetService("ReplicatedStorage"),
game:GetService("ServerScriptService"),
game:GetService("ServerStorage"),
game:GetService("StarterGui"),
game:GetService("StarterPack"),
game:GetService("StarterPlayer"),
game:GetService("Teams"),
game:GetService("SoundService"),
game:GetService("Chat"),
game:GetService("LocalizationService"),
game:GetService("NetworkClient")
}
for i = 1,#assets do
local assetToLoad = assets[i]
ContentProvider:PreloadAsync({assetToLoad})
local newX = i / #assets
script.Parent.Parent.loading.loadingBars.assets.Text = "Loading Assets: "..math.floor (i / #assets * 100).."%"
end
The only difference is I manually listed the assets I wanted to load in.
This one should work, as I've tested it before. If this seems to not work, let me know and I'll fix it for you.
Hope this helped!
1 comment
Try changing the last part of line 7 from 'PreloadAsync((service))' to 'PreloadAsync({service})'