Hi,
Basically, I’ve tried to fix this code in many different ways, but it is still not working:
--// Instance count \\--
local instances = 0
local parts = 0
local unions = 0
local sounds = 0
local scripts = 0
local miscs = 0
local lightings = 0
local constraints = 0
local values = 0
local effects = 0
local uis = 0
for i, v in pairs(game:GetDescendants()) do
if v:IsA("BasePart") then
parts += 1
elseif v:IsA("UnionOperation") then
unions += 1
elseif classesmod.ui[v.ClassName] then
uis += 1
elseif classesmod.sound[v.ClassName] then
sounds += 1
elseif classesmod.scripts[v.ClassName] then
scripts += 1
elseif classesmod.lighting[v.ClassName] then
lightings += 1
elseif classesmod.constraints[v.ClassName] then
constraints += 1
elseif classesmod.effects[v.ClassName] then
effects += 1
elseif classesmod.values[v.ClassName] then
values += 1
else
miscs += 1
end
end
-- debugging
print(tostring(uis))
Here, “classesmod” is a module script with tables for each class, for example, “UI” is a table with everything related to UI inside. What’s wrong is that when I print “uis”, it prints “0” even tho I have a lot more than 0 UI elements in my game.
If anyone could fix this, it would be much appreciated!