Find assets not in use

Hi everyone,

Is there currently a plugin or some type of way to identify which assets (meshes, sounds, etc.) I have in Replicated/ServerStorage that aren’t being used by scripts in any way? I like to copy assets that I use in previous games over to my new game to save time, but there are a lot of assets I won’t use and it could increase loading time significantly.

1 Like

You could use a for loop maybe. I have no idea about this, but I think a for loop would help. You could use :GetDescendants() and check to see if the value has any scripts inside of it. If that doesn’t work for you or isn’t useful, then I sadly can’t help you. :frowning:

1 Like

I think there are no such plugins, but you can try to create them yourself, and they will only work if the parts are named differently, otherwise elements with the same names in which at least one is used will not be shown.

Code Example

local Services = {
	workspace,
	game:GetService("ReplicatedStorage"),
	game:GetService("ServerScriptService"),
	game:GetService("ReplicatedFirst"),
	game:GetService("StarterGui"),
	game:GetService("ServerStorage")
}

local Script = ""
local ScriptClass = {"LocalScript", "Script", "ModuleScript"}

for _, v in pairs(Services) do
	for _, v1 in pairs(v:GetDescendants()) do
		if table.find(ScriptClass, v1.ClassName) then
			Script = Script .. v1.Source
		end
	end
end

for _, v in pairs(Services) do
	for _, v1 in pairs(v:GetDescendants()) do
		if not table.find(ScriptClass, v1.ClassName) then
			if not string.find(string.lower(Script), string.lower(v1.Name)) then
				print(`'{v1:GetFullName()}' is not used in any script.`)
			end
		end
	end
end


warn("CHECKING DONE!")

put it in studio command bar and look at output

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.