Hey developers, I have been experimenting with ContentProvider
loading screens and I’ve came across an error. I try destroying a screengui with :Destroy()
and it doesn’t do anything. There are no errors in the output, and its just been annoying me. I think its due to the ContentProvider
script above it, but I don’t know how to fix that.
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
loaded = false
local content = game:GetService('ContentProvider')
local assets = {}
local disasset = {
['Lighting'] = false;
}
script.Parent.Text = 'Loading (1/4)'
local startTick = tick()
content:PreloadAsync(assets)
script.Parent.Text = 'Loading (2/4)'
for i, service in pairs(game:GetChildren()) do
pcall(function()
if not disasset[service.Name] then
script.Parent.Text = 'Loading (3/4)'
content:PreloadAsync({service})
end
end)
end
loaded = true
script.Parent.Text = 'Loaded!'
script.Parent.TextTransparency = 0
script.Parent:TweenPosition(UDim2.new(0.43, 0,0, 726, 0), 'In', 'Back', .7)
wait(1)
script.Parent.Parent:TweenPosition(UDim2.new(0,0,1,0), 'InOut', 'Sine', .7)
wait(1)
local plrgui = game.Players.LocalPlayer:WaitForChild('PlayerGui')
local frame = plrgui.Loading
frame:Destroy()
I would appreciate a solutions, thanks.