Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I detect the amount of models in a game every second?

MY attempt, which of course didn't work >.>

for i,v in pairs(workspace:GetChildren())
                if v.ClassName == "Model" then
		models = v
        end
end

for i = 1, #v do
script.Parent.Value = i[v]
end

1 answer

✓ Accepted answer

Some of your syntax is a bit splotchy, I fixed it up for you.

I mean, having a loop might generate a little lag.

while wait(1) do
	numModels = 0
	
	for i,v in pairs (game.Workspace:GetChildren()) do
		if v:IsA("Model") then
			numModels = numModels + 1
		end
	end
	
	print(numModels)
end

2 comments

0

i wanted it every second?

0

thank you sir :D

This discussion is preserved as it was. New answers, comments, and votes are closed.