Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Loading Assets Gui not working in server mode?

I've made a Loading Assets Gui that will load the assets so players do not crash, but the problem is, it only works in studio local test but not in server. But I keep getting this error. Error: https://prnt.sc/iww1e4 and this https://prnt.sc/iww1ln (Both the same)

Check out the links

Placed:

PlayedAdded script: https://prnt.sc/iww205 and inside the script https://prnt.sc/iww27n

The main problem: https://prnt.sc/iww2fd Inside the script https://prnt.sc/iww2je

Can anyone help? Although the output keeps saying 'can only tween objects in the workspace' even though it works in Local but not in real server.

I would appreciate the help, thank you.

1 comment

0

Can you use a code block for the scriots

1 answer

✓ Accepted answer

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:

--Example script
local ContentProvider = Game:GetService("ContentProvider")
 
-- load a bunch of assets
local assets = {2253543, 2434541, 5133543, 2423433}
for _, asset in ipairs(assets) do
	ContentProvider:Preload("http://www.roblox.com/asset/?id=" .. asset)
end
 
-- wait for them to complete
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

2 comments

0

Thank you!! Helped.

0

No problem ;)

This discussion is preserved as it was. New answers, comments, and votes are closed.