Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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

Ad

Answer this question