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

How do you check if there is more than one of an object?

I am currently trying to figure out how to check for more than one of the same object and how to get rid of extras. Does anyone know how to do this?

1 answer

use #whatever:GetChildren() then if it's more than however many you want maybe use a for loop to do something like..

local things = whatever:GetChildren()
for i = 1,(#things - 1)in pairs(things) do wait() --leaving one of the objects
v:Destroy()
end

I'm pretty new though so there might be a better way :P

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