Hey Developers!, I’m trying to make my first “Script Counter”, But, while i run into the loop,
I Get this error, Is there any way to avoid this?, i guess I Don’t have permission to check the ClassName of certain objects? this error breaks the loop, making me unable to use it
Error:
Script:
--Script Counter
local Delay = .0005
function CountScripts()
local Final_Scripts =0
local Final_LocalScripts =0
local Final_Modules =0
for _,child in pairs(game:GetDescendants()) do
if child:IsA("Script") then
Final_Scripts = Final_Scripts + 1
elseif child:IsA("LocalScript") then
Final_LocalScripts = Final_LocalScripts + 1
elseif child:IsA("ModuleScript") then
Final_Modules = Final_Modules + 1
end
yield(Delay)
end
warn("Done")
ScriptCounter_Scripts.Text = "Server Scripts: "..Final_Scripts
ScriptCounter_LocalScripts.Text = "Local Scripts: "..Final_LocalScripts
ScriptCounter_Modules.Text = "Modules : "..Final_Modules
end
Feel free to give any tips to improve it aswell.