Error code:
14:32:01.112 - The current identity (2) cannot Class security check (lacking permission 6)
14:32:01.113 - Stack Begin
14:32:01.113 - Script 'ReplicatedFirst.loading', Line 11
14:32:01.115 - Stack End
My script:
script.Parent:RemoveDefaultLoadingScreen() local loadingScreen = script.loading loadingScreen.Parent = game.Players.LocalPlayer.PlayerGui local contentProvider = game:GetService("ContentProvider") local toLoad = game:GetDescendants() local total = #toLoad for i, v in pairs(toLoad) do loadingScreen.background.counter.Text = "Loading: "..i.."/"..total.." "..v.Name loadingScreen.background.loadingBar.progress.Size = UDim2.new(i/total, 0, 1, 0) contentProvider:PreloadAsync({v}) end wait(1) loadingScreen:Destroy()
Use a pcall function so it will skip over the error.
game.ReplicatedFirst:RemoveDefaultLoadingScreen() local loadingscreen = script.Parent.loading local RunService = game:GetService("RunService") local ContentProvider = game:GetService("ContentProvider") local Descendants = game:GetDescendants() for i, v in pairs(Descendants) do local sucess, errormessage = pcall(function() ContentProvider:PreloadAsync({v}) loadingscreen.Text = "loading: " .. i .. " / " .. #game:GetDescendants() end) end game:GetService("Debris"):AddItem(loadingscreen, 2)