Errors
First of all,lets look at the code you have
local contentprovider = game.ContentProvider
local frame = script.Parent.Frame
while wait() do
if contentprovider.RequestQueueSize == 0 then
frame:TweenPosition(Udim2.new(0,0,-1,0),"In","Quart",1)
wait(1)
script.Parent:Destroy()
end
end
Error #1
Content Provider is a service,you can't call it by game.ContentProvider You will have to use
game:GetService("ContentProvider")
I will provide something for your player added script.
I recommend putting the gui as a child of the player added script since replicated storage is also a service
local gui = script.NameOfGUI
game.Players.PlayerAdded:Connect(function(plr)
local plrgui = plr.PlayerGui
local clone = gui:Clone()
clone.Parent = plrgui
end)
Lets go back to your main script
Error #2
What are you trying to load?If you want to use RequestQueueSize, you need something to load,try publishing what you are trying to load,something like this:
local ContentProvider = Game:GetService("ContentProvider")
local assets = {2253543, 2434541, 5133543, 2423433}
for _, asset in ipairs(assets) do
ContentProvider:Preload("http://www.roblox.com/asset/?id=" .. asset)
end
while ContentProvider.RequestQueueSize > 0 do
wait(0.1)
end
Error#3
What is script.parent.Frame?Your script should be in the frame itself,not the screengui.Also,you should :Destroy() the whole screengui
Lets fix the errors and put in in a script
local asset = idofmodel
local frame = script.Parent
game:GetService("ContentProvider"):PreloadAsync({ "http://www.roblox.com/asset/?id=" .. asset })
while game:GetService("ContentProvider").RequestQueueSize > 0 do
wait(0.1)
script.Parent.Load.Text = "Assets Remaining:".. game:GetService("ContentProvider").RequestQueueSize
end
if game:GetService("ContentProvider").RequestQueueSize == 0 then
frame:TweenPosition(UDim2.new(0,0,-1,0),"In","Quart",1)
wait(1)
frame.Parent:Destroy()
end
make sure it is a local script
any errors please comment below
1 comment
Can you use a code block for the scriots