I wouldn’t do this, you’re essentially going to clone everything, move it to a folder, when it’s done loading, move it to where it was.
A simpler method and solution is to just :PreloadAsync the entire map. (not workspace)
Just put everything and whatever that is important and needs to be loaded inside a folder.
Yes I want to put every asset that I need, but the problem is, I cant individually store all of them one by one because they’re so many. To simply explain for example, I want to preload the color green, but they’re all over the place and cannot all be pasted into a folder because you only need one part with the color green.
Same goes with the assets that I have, they’re so many, I can’t paste all of the duplicated textures into a folder because that would be massive, I only want one of each texture
I don’t understand what you’re trying to do. If “they’re so many”, then why don’t you just load the entire thing? You do know that you don’t have to do :PreloadAsync(“Green”, “Texture”, “bla”, “bla”).
Just :PreloadAsync(map) – assuming map is a folder and it’ll load everything.
Duplicated textures isn’t really an issue, cause it loads for the rbxassetid.
Sorry if I’m wrong, I’m just not understanding why you can’t do :PreloadAsync(map). Could you explain more about why?
usually if you want to preload assets, you use the preload service on folders containing examples for all the assets you wish to preload somewhere in storage
Cheap way of making these is to go through all things in the game and fill up folders with instances of specific types using a script
Also, if you want to make a progress bar without using the preload queue size thing, you can preload each object individually in the folder or each folder individually
No I’ve already done that before I even posted this post, everything, the only thing I need to copy paste is all the textures, but they’re literally over a hundred duplicates. I want to only copy 1 and paste a texture for each ID
If you use a script you can do this by using a dictionary as if the id is already in the table, it will not be added like an array. then you can just put duplicates of all items in the dictionary into the folder (or place a duplicate of the asset if one hasnt been made already (not in the table) during the loop)
Example:
local lookup = {}
local addAsset = function(object, id, parent)
if not lookup[id] then
lookup[id] = true
object:Clone().Parent = parent
end
end
for _, storage in ipairs(storagePlaces) do
for _, object in ipairs(storage:GetDescendants()) do
if object:IsA("Sound") then
addAsset(object, object.SoundId, folders.SFX)
elseif object:IsA("MeshPart") then
addAsset(object, object.MeshId, folders.Meshes)
end
end
end
function alreadyExists(texture)
local exists = false
for _,v in pairs(workspace.Texture:GetChildren()) do
if v.TextureId == texture.TextureId then
exists = true
end
end
return exists
end
for _,v in pairs(workspace:GetDescendants()) do
if v:IsA("Texture") then
if alreadyExists(v) == false then
v:Clone().Parent = workspace.Texture -- clone to texture folder
end
end
end