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

Can you add a limit of items that you can store in a folder?

Hello, is it possible to make a folder have its max items? Like that in a specific folder there would be only able to store 4 items in there? If yes, how to do it?

Thank you.

1 answer

✓ Accepted answer

You can check the amount of objects inside the folder before adding anything

local folder = pathtofolder
if #folder:GetChildren() == 4 then return end

Now you put that inside your function that adds the items If this helped mark it as correct.

5 comments

0

Thank you, but that doesn't work for me, I want to make it that it would't be possible to store more than 4 items in the folder.

0

That's why you check before adding any object inside of it

0

Oh, yea you were right, but for some reason it does it for 6 items not for 4 :/

0

instead of going through the folder every time. You could store a int value that has a value of 0. Then every time you store something in the folder add 1 to that value. Then before you store something in the folder just say folder:FindFirstChild(“theintvaluesname”) and if it’s value is 4 then don’t store anything.

0

Thank you, and the if it’s value is 4 then don’t store anything -- You mean return end?

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