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 and here at the devforum I searched lot of topics but I don’t find any one that could work for me.
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
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()