Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

i want to make loading assets to my game but it;s error can you fix it??

Asked by 4 years ago
Edited 4 years ago

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()
0
Using game:GetDescendants() will also attempt to extract data from core scripts and core gui. LinavolicaDev 570 — 4y
0
Try to get the data separately. LinavolicaDev 570 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

SOLVING

Use a pcall function so it will skip over the error.

SCRIPTING


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)
Ad

Answer this question