How to make a Loader [FOR A GUI]

Hello developers, well, I have a problem that is that I want to make a Loader script of a GUI.

  • I searched here a lot of topics, but I didn’t found anyone working for me and I don’t know how to do it.

  • I tried with lot of scripts I found, etc even YT tutorials, but YT tutorial were like from 2017 :confused: and here at the devforum I searched lot of topics but I don’t find any one that could work for me.

The think I want to do:

requiere("ID") [Or the way that can work]

And in the game appears the GUI.

  • If you could help me I’ll appreciate it!
    :slight_smile:

Thanks to all!

Use ContentProvider.

Here’s a method I always use (taken from internet):

--Import Models  to Workspace.
local Link = "rbxassetid://" 
local ModelId = 000000000 
for _, object in pairs(game:GetObjects(Link..ModelId)) do
	object.Parent = game:GetService("Workspace")
end

Well, the problem of that script is the following:

Is perfect for importing models, but I need to import a GUI to starter GUI to make it work.

But thanks for the reply!

If you are doing it on the local client then try this:

local ModelId = 000000000 
for _, object in pairs(game:GetObjects("rbxassetid://"..ModelId)) do
	object.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
end

If you are doing this on the server then try this:

local ModelId = 000000000 
for _, object in pairs(game:GetObjects("rbxassetid://"..ModelId)) do
	object.Parent = player:WaitForChild("PlayerGui") --'player' declares Player Instance.
end

Edit: this will only work in command bar and plugins (I don’t know how did it work for you @fancal241yo). Here’s what you can do in scripts:

local Model = game:GetService("InsertService"):LoadAsset(5286735590)
local NewModel = Model:GetChildren()[1]
NewModel.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
Model:Destroy()
1 Like

Thanks you so much worked perfectly! :slight_smile: