I want to make a script that will load and unload specific things (like rigs for example).
As I have around 200+ rigs that are close to each other, this pretty much makes the game load every asset’s texture, thus the time needed to load core scripts and other more important assets.
My current method is moving rigs from workspace and parenting them to ReplicatedStorage locally, but ReplicatedStorage depending on distance.
But I’m pretty sure the content still decides to load in the background (due to nature of ReplicatedStorage and the fact that when I first enter the game, all rigs are visible and loaded, therefore the server sending a request for all content to load therefore it does not matter where I’ve set the rigs when that initial request was already made)
So does anyone have ideas how to make such system?
I’m using a module script that adds a click detector to all outfits at start, so StreamingEnabled does not really work well as the rigs “technically” don’t exist until I get close to them, therefore the initial check skips those who don’t exist and that serves an issue later on because the non-existing rigs won’t have a click detector.
Is there any reason why you can’t just add the click detectors manually?
Im kinda failing to understand what you’re trying to do here btw. Do you want the rigs to originally load, and then be able to be unloaded, or do you want the rigs to not be loaded at first?
(From what I can tell, you want the outfits to be loaded at the start to add the click detector, but you don’t want them to be loaded at the start judging from the fact that you did not want ReplicatedStorage to have all rigs be visible and loaded when you join the game)
I had a problem with something kind of like this. Mass research came up with a simplistic solution.
local cars=game:GetService("ServerStorage"):WaitForChild("CarFolder")
local content={"IronHead","Hellcat01","Hellcat02","Hellcat03",
"Chevy01","Chevy02","Chevy03","Super01","Super02","Super03",
"Coupe01","Coupe02","Coupe03"
}
local ContentFolder=game:GetService("ServerStorage"):WaitForChild("CarFolder")
local preload={};for _,objName in ipairs(content)do
table.insert(preload,ContentFolder:WaitForChild(objName))
end --print(preload)
local ContentProvider=game:GetService("ContentProvider")
ContentProvider:PreloadAsync(preload)
That’s it, they are just as buffered as if you loaded them to the workspace and deleted them.
As my module script adds click detectors at start, they need to exist, but if they do exist, then all the content on them (textures) will start loading in a queue…
So what you want is for the models themselves to be loaded, but the textures to not be loaded until later on?
In that case, perhaps try storing all the textures in some sort of script instead of having them applied to the models at the start, and wait until everything else is loaded before you apply the textures?
You can’t force them not to load, but you can just get rid of the accessories and add them by script. (atleast you probably can)
Assuming that the accessories and stuff uses asset IDs or humanoidDescriptions, you can store those on the server and have the client request those after everything else has loaded.
Otherwise, why not add the click detectors on the server or have the models start with click detectors and simply connect those later on?